In the past I have recorded a number of scripts to be used in batch processing, but am not at all familiar with Python, so have never written my own. A recent effort to record one has, so far, failed.
I have a group of some 475 images. I want to add a unique number at the same exact location to each. I start recording, click the font, size and color I want, open the Text command and then run into a wall. I need the script to pause at this point and allow me to enter a number, but I've been unsuccessful in making this happen. And then, of course, I need the script to close.
Any advice would be greatly appreciated. I would not look forward to positioning the text cursor at an exact location, with my unsteady hand, 475 times.
Thanks.
Trouble recording a script
Moderator: Kathy_9
-
LeviFiction
- Advisor
- Posts: 6831
- Joined: Thu Oct 02, 2008 1:07 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Alienware M17xR4
- processor: Intel Core i7-3630QM CPU - 2_40GH
- ram: 6 GB
- Video Card: NVIDIA GeForce GTX 660M
- sound_card: Sound Blaster Recon3Di
- Hard_Drive_Capacity: 500GB
- Corel programs: PSP: 8-2023
- Location: USA
Re: Trouble recording a script
Batch scripting isn't really designed for user input. There is a command for grabbing a number from the user. However, if you do this in a batch script it'll run on every single image and ask for a number all 475 times. If this is what you want, fine.
You can post your recorded script here and we can quickly add the command and variables necessary. Or you can continue down and I'll try (and fail) to explain the process.
So here's a general overview of the process. I recommend learning Python basics, it's really easy, but until then here's how this works.
1) Record all of the steps including putting the first number in the textbox.
2) Open the script in a text editor like Notepad, or Notepad++ (for developers)
3) Add the GetNumber command just before the text command and assign it to a variable (discussed below)
4) Use that variable as the input for the 'Characters' parameter of the TextEx command.
So onto some basics.
Python uses spaces, tabs, etc. to define what areas of the program belong together. PSP by default uses 4 spaces to indent commands. So when editing the program you must also start any new lines 4 spaces in.
When you look at the script you'll see a line that says
This is where the "Do" function is defined and it's where all of your script goes. When PSP loads a script it loads the entire file into memory and then calls this command.
All of PSP's commands start the same way
This formatting is mostly arbitrary, it's both to make sure that parts that belong together stay together (otherwise errors will occur) and also for readability. Technically all of this could be written on a single line. but it's easier to read this way.
The first command you'll see is 'EnabledOptimizedScriptUndo'. You don't need to worry about this it just cleans up a few things when the script starts.
Just before the TextEx command, and just after any other command in front of it, you'll need to add this code, remember it needs to be indented with 4 spaces.
If you don't want a maximum or minimum value for this number, just delete those two lines. This command pops-up a dialog asking for a number. When the user hits "OK" that number will be sent to the dictionary variable "Result" with the key of 'EnteredNumber' and can be accessed using this syntax "Result['EnteredNumber']" It should be noted I'm not covering catching errors or using IF statements to control the flow of the program. So if someone hits Cancel or leaves the value blank it'll be fine but the script will continue and a blank text value will be added.
Then inside the TextEx command you'll see a paramter 'Characters'. Here you'll replace the text that's already there with "Result['EnteredNumber']" Like this.
You can post your recorded script here and we can quickly add the command and variables necessary. Or you can continue down and I'll try (and fail) to explain the process.
So here's a general overview of the process. I recommend learning Python basics, it's really easy, but until then here's how this works.
1) Record all of the steps including putting the first number in the textbox.
2) Open the script in a text editor like Notepad, or Notepad++ (for developers)
3) Add the GetNumber command just before the text command and assign it to a variable (discussed below)
4) Use that variable as the input for the 'Characters' parameter of the TextEx command.
So onto some basics.
Python uses spaces, tabs, etc. to define what areas of the program belong together. PSP by default uses 4 spaces to indent commands. So when editing the program you must also start any new lines 4 spaces in.
When you look at the script you'll see a line that says
Code: Select all
def Do():
#code indented underneath like this
All of PSP's commands start the same way
Code: Select all
#CommandName - this is a comment telling you what the command is
App.Do( Environment, 'CommandName', { #curly braces begin a dictionary/map variable that uses key value pairs to send parameters to the command
#Parameters start here. They look like this 'Parameter': Value
}) #command ends with the last curly brace and closing parenthesis
The first command you'll see is 'EnabledOptimizedScriptUndo'. You don't need to worry about this it just cleans up a few things when the script starts.
Just before the TextEx command, and just after any other command in front of it, you'll need to add this code, remember it needs to be indented with 4 spaces.
Code: Select all
Result = App.Do( Environment, 'GetNumber', {
'DefaultValue': 0, # values for test purposes only
'MinValue': 10,
'MaxValue': 16,
'DialogTitle': 'Number Entry',
'Prompt': 'Enter a Number',
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
}
})
Then inside the TextEx command you'll see a paramter 'Characters'. Here you'll replace the text that's already there with "Result['EnteredNumber']" Like this.
Code: Select all
# Text
App.Do( Environment, 'TextEx', {
'Visibility': True,
'CreateAs': App.Constants.CreateAs.Vector,
# To keep this short we're skipping down to the paramter
'Characters': Result['EnteredNumber'],
# The rest of the command here
https://levifiction.wordpress.com/
-
ayberry
- Posts: 3
- Joined: Wed Mar 18, 2020 4:32 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- processor: Intel Core i7-7700
- ram: 16GB
- Video Card: GeForce GTX 1060 3GB
- Hard_Drive_Capacity: 1 TB
- Monitor/Display Make & Model: Samsung CF391
- Corel programs: PaintShop Pro 2020 Ultimate
Re: Trouble recording a script
Wow! Very much appreciate the help.
I started copying your code into my script but decided your offer to modify the script would be much safer. "... it'll run on every single image and ask for a number all 475 times," is exactly what I want.
A copy of the script follows (also attached as .PspScript). The 'MinValue': and 'MaxValue' are not needed, although I suppose those numbers would be 1 and 475. I've also attached 3 images that can be used for testing if necessary. Even numbered pages will require another script but I can manage changing the location point from 978 to 826.
Thank you kindly for your effort.
______________________________________________________________
from PSPApp import *
def ScriptProperties():
return {
'Author': u'',
'Copyright': u'',
'Description': u'',
'Host': u'PaintShop Pro',
'Host Version': u'22.00'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# Eraser
App.Do( Environment, 'Eraser', {
'BrushTip': {
'Shape': App.Constants.BrushShape.Rectangular,
'CustomBrush': None,
'Size': 100,
'Hardness': 100,
'Step': 1,
'Density': 100,
'Thickness': 100,
'Rotation': 0,
'BrushVariance': {
'SizeVariance': App.Constants.VarianceMethod.Pressure,
'SizeJitter': 0,
'OpacityVariance': App.Constants.VarianceMethod.None,
'OpacityJitter': 0,
'DensityVariance': App.Constants.VarianceMethod.None,
'DensityJitter': 0,
'ThicknessVariance': App.Constants.VarianceMethod.None,
'ThicknessJitter': 0,
'RotationVariance': App.Constants.VarianceMethod.None,
'RotationJitter': 0,
'PositionJitter': 0,
'UseScaledPositionJitter': False,
'ImpressionsPerStep': 1,
'FadeRate': 100
},
'BrushTrayShow': False
},
'Brush': {
'Opacity': 100,
'CAMG': {
'SupportCAMG': False,
'EngineType': App.Constants.CAMGEngineType.MagicWand,
'FeatherDegree': 0,
'AntiAliasing': 0,
'MagicWand': {
'MatchMode': App.Constants.MatchMode.None,
'Tolerance': 0,
'Contiguous': False
},
'Segmentation': {
},
'ObjectExtractor_PCA': {
}
}
},
'PrimaryMaterial': App.Constants.MaterialRef.Foreground,
'ForegroundMaterial': None,
'BackgroundMaterial': None,
'Stroke': [
(App.Constants.PathEntryInterpretation.Absolute,(885.5,2604.5),0),
(App.Constants.PathEntryInterpretation.Absolute,(888.5,2604.5),2015),
(App.Constants.PathEntryInterpretation.Absolute,(892.5,2604.5),2031),
(App.Constants.PathEntryInterpretation.Absolute,(904.5,2604.5),2031),
(App.Constants.PathEntryInterpretation.Absolute,(912.5,2604.5),2047),
(App.Constants.PathEntryInterpretation.Absolute,(924.5,2604.5),2047),
(App.Constants.PathEntryInterpretation.Absolute,(935.5,2604.5),2062),
(App.Constants.PathEntryInterpretation.Absolute,(947.5,2604.5),2062),
(App.Constants.PathEntryInterpretation.Absolute,(955.5,2604.5),2078),
(App.Constants.PathEntryInterpretation.Absolute,(967.5,2604.5),2078),
(App.Constants.PathEntryInterpretation.Absolute,(974.5,2604.5),2093),
(App.Constants.PathEntryInterpretation.Absolute,(982.5,2604.5),2093),
(App.Constants.PathEntryInterpretation.Absolute,(990.5,2604.5),2109),
(App.Constants.PathEntryInterpretation.Absolute,(994.5,2604.5),2125),
(App.Constants.PathEntryInterpretation.Absolute,(1006.5,2604.5),2125),
(App.Constants.PathEntryInterpretation.Absolute,(1010.5,2604.5),2140),
(App.Constants.PathEntryInterpretation.Absolute,(1017.5,2604.5),2140),
(App.Constants.PathEntryInterpretation.Absolute,(1021.5,2604.5),2156),
(App.Constants.PathEntryInterpretation.Absolute,(1029.5,2604.5),2156),
(App.Constants.PathEntryInterpretation.Absolute,(1033.5,2604.5),2172),
(App.Constants.PathEntryInterpretation.Absolute,(1041.5,2604.5),2172),
(App.Constants.PathEntryInterpretation.Absolute,(1045.5,2604.5),2187),
(App.Constants.PathEntryInterpretation.Absolute,(1049.5,2604.5),2203),
(App.Constants.PathEntryInterpretation.Absolute,(1053.5,2604.5),2203),
(App.Constants.PathEntryInterpretation.Absolute,(1056.5,2604.5),2218),
(App.Constants.PathEntryInterpretation.Absolute,(1060.5,2604.5),2234),
(App.Constants.PathEntryInterpretation.Absolute,(1064.5,2604.5),2250)
],
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'RandomSeed': 45044242,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# Text
App.Do( Environment, 'TextEx', {
'Visibility': True,
'CreateAs': App.Constants.CreateAs.Vector,
'Start': (978,2541),
'TextFlow': App.Constants.TextFlow.HorizontalDown,
'TextType': App.Constants.TextType.TextBase,
'Matrix': [
1,
0,
0,
0,
1,
0,
0,
0,
1
],
'AutoKern': True,
'Kerning': 0,
'Tracking': 0,
'Leading': 0,
'Font': u'Calibri',
'PointSize': 12,
'Italic': False,
'Bold': False,
'Underline': False,
'SuperScript': False,
'SubScript': False,
'Strikethru': False,
'AntialiasStyle': App.Constants.AntialiasEx.Sharp,
'WarpText': True,
'SetText': App.Constants.Justify.Center,
'Fill': None,
'Stroke': None,
'LineWidth': 0,
'LineStyle': {
'Name': u'',
'FirstCap': (u'Butt',0.25,0.25),
'LastCap': (u'Butt',0.25,0.25),
'FirstSegCap': (u'',0.25,0.25),
'LastSegCap': (u'',0.25,0.25),
'UseSegmentCaps': False,
'Segments': None
},
'Join': App.Constants.JointStyle.Miter,
'MiterLimit': 10,
'Characters': u'1',
'Strings': None,
'TextTarget': (0,0,[1],True),
'PathTarget': None,
'InObject': False,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'PreviewVisible': True,
'AutoProof': False,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# FileSave
App.Do( Environment, 'FileSave', {
'Encoding': {
'PNG': {
'Interlaced': False,
'OptimizedPalette': True,
'AlphaChannel': False
}
},
'FileName': u'',
'FileFormat': App.Constants.FileFormat.Unknown,
'PluginFormat': 0,
'WorkingMode': 0,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'DialogPlacement': {
'ShowMaximized': False,
'Rect': ((0,0), 0, 0)
},
'AutoActionMode': App.Constants.AutoActionMode.AllAlways,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
},
'DefaultProperties': []
})
# FileClose
App.Do( Environment, 'FileClose', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# SelectDocument
App.Do( Environment, 'SelectDocument', {
'SelectedImage': -1,
'Strict': False,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
I started copying your code into my script but decided your offer to modify the script would be much safer. "... it'll run on every single image and ask for a number all 475 times," is exactly what I want.
A copy of the script follows (also attached as .PspScript). The 'MinValue': and 'MaxValue' are not needed, although I suppose those numbers would be 1 and 475. I've also attached 3 images that can be used for testing if necessary. Even numbered pages will require another script but I can manage changing the location point from 978 to 826.
Thank you kindly for your effort.
______________________________________________________________
from PSPApp import *
def ScriptProperties():
return {
'Author': u'',
'Copyright': u'',
'Description': u'',
'Host': u'PaintShop Pro',
'Host Version': u'22.00'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# Eraser
App.Do( Environment, 'Eraser', {
'BrushTip': {
'Shape': App.Constants.BrushShape.Rectangular,
'CustomBrush': None,
'Size': 100,
'Hardness': 100,
'Step': 1,
'Density': 100,
'Thickness': 100,
'Rotation': 0,
'BrushVariance': {
'SizeVariance': App.Constants.VarianceMethod.Pressure,
'SizeJitter': 0,
'OpacityVariance': App.Constants.VarianceMethod.None,
'OpacityJitter': 0,
'DensityVariance': App.Constants.VarianceMethod.None,
'DensityJitter': 0,
'ThicknessVariance': App.Constants.VarianceMethod.None,
'ThicknessJitter': 0,
'RotationVariance': App.Constants.VarianceMethod.None,
'RotationJitter': 0,
'PositionJitter': 0,
'UseScaledPositionJitter': False,
'ImpressionsPerStep': 1,
'FadeRate': 100
},
'BrushTrayShow': False
},
'Brush': {
'Opacity': 100,
'CAMG': {
'SupportCAMG': False,
'EngineType': App.Constants.CAMGEngineType.MagicWand,
'FeatherDegree': 0,
'AntiAliasing': 0,
'MagicWand': {
'MatchMode': App.Constants.MatchMode.None,
'Tolerance': 0,
'Contiguous': False
},
'Segmentation': {
},
'ObjectExtractor_PCA': {
}
}
},
'PrimaryMaterial': App.Constants.MaterialRef.Foreground,
'ForegroundMaterial': None,
'BackgroundMaterial': None,
'Stroke': [
(App.Constants.PathEntryInterpretation.Absolute,(885.5,2604.5),0),
(App.Constants.PathEntryInterpretation.Absolute,(888.5,2604.5),2015),
(App.Constants.PathEntryInterpretation.Absolute,(892.5,2604.5),2031),
(App.Constants.PathEntryInterpretation.Absolute,(904.5,2604.5),2031),
(App.Constants.PathEntryInterpretation.Absolute,(912.5,2604.5),2047),
(App.Constants.PathEntryInterpretation.Absolute,(924.5,2604.5),2047),
(App.Constants.PathEntryInterpretation.Absolute,(935.5,2604.5),2062),
(App.Constants.PathEntryInterpretation.Absolute,(947.5,2604.5),2062),
(App.Constants.PathEntryInterpretation.Absolute,(955.5,2604.5),2078),
(App.Constants.PathEntryInterpretation.Absolute,(967.5,2604.5),2078),
(App.Constants.PathEntryInterpretation.Absolute,(974.5,2604.5),2093),
(App.Constants.PathEntryInterpretation.Absolute,(982.5,2604.5),2093),
(App.Constants.PathEntryInterpretation.Absolute,(990.5,2604.5),2109),
(App.Constants.PathEntryInterpretation.Absolute,(994.5,2604.5),2125),
(App.Constants.PathEntryInterpretation.Absolute,(1006.5,2604.5),2125),
(App.Constants.PathEntryInterpretation.Absolute,(1010.5,2604.5),2140),
(App.Constants.PathEntryInterpretation.Absolute,(1017.5,2604.5),2140),
(App.Constants.PathEntryInterpretation.Absolute,(1021.5,2604.5),2156),
(App.Constants.PathEntryInterpretation.Absolute,(1029.5,2604.5),2156),
(App.Constants.PathEntryInterpretation.Absolute,(1033.5,2604.5),2172),
(App.Constants.PathEntryInterpretation.Absolute,(1041.5,2604.5),2172),
(App.Constants.PathEntryInterpretation.Absolute,(1045.5,2604.5),2187),
(App.Constants.PathEntryInterpretation.Absolute,(1049.5,2604.5),2203),
(App.Constants.PathEntryInterpretation.Absolute,(1053.5,2604.5),2203),
(App.Constants.PathEntryInterpretation.Absolute,(1056.5,2604.5),2218),
(App.Constants.PathEntryInterpretation.Absolute,(1060.5,2604.5),2234),
(App.Constants.PathEntryInterpretation.Absolute,(1064.5,2604.5),2250)
],
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'RandomSeed': 45044242,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# Text
App.Do( Environment, 'TextEx', {
'Visibility': True,
'CreateAs': App.Constants.CreateAs.Vector,
'Start': (978,2541),
'TextFlow': App.Constants.TextFlow.HorizontalDown,
'TextType': App.Constants.TextType.TextBase,
'Matrix': [
1,
0,
0,
0,
1,
0,
0,
0,
1
],
'AutoKern': True,
'Kerning': 0,
'Tracking': 0,
'Leading': 0,
'Font': u'Calibri',
'PointSize': 12,
'Italic': False,
'Bold': False,
'Underline': False,
'SuperScript': False,
'SubScript': False,
'Strikethru': False,
'AntialiasStyle': App.Constants.AntialiasEx.Sharp,
'WarpText': True,
'SetText': App.Constants.Justify.Center,
'Fill': None,
'Stroke': None,
'LineWidth': 0,
'LineStyle': {
'Name': u'',
'FirstCap': (u'Butt',0.25,0.25),
'LastCap': (u'Butt',0.25,0.25),
'FirstSegCap': (u'',0.25,0.25),
'LastSegCap': (u'',0.25,0.25),
'UseSegmentCaps': False,
'Segments': None
},
'Join': App.Constants.JointStyle.Miter,
'MiterLimit': 10,
'Characters': u'1',
'Strings': None,
'TextTarget': (0,0,[1],True),
'PathTarget': None,
'InObject': False,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'PreviewVisible': True,
'AutoProof': False,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# FileSave
App.Do( Environment, 'FileSave', {
'Encoding': {
'PNG': {
'Interlaced': False,
'OptimizedPalette': True,
'AlphaChannel': False
}
},
'FileName': u'',
'FileFormat': App.Constants.FileFormat.Unknown,
'PluginFormat': 0,
'WorkingMode': 0,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'DialogPlacement': {
'ShowMaximized': False,
'Rect': ((0,0), 0, 0)
},
'AutoActionMode': App.Constants.AutoActionMode.AllAlways,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
},
'DefaultProperties': []
})
# FileClose
App.Do( Environment, 'FileClose', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# SelectDocument
App.Do( Environment, 'SelectDocument', {
'SelectedImage': -1,
'Strict': False,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
-
LeviFiction
- Advisor
- Posts: 6831
- Joined: Thu Oct 02, 2008 1:07 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- motherboard: Alienware M17xR4
- processor: Intel Core i7-3630QM CPU - 2_40GH
- ram: 6 GB
- Video Card: NVIDIA GeForce GTX 660M
- sound_card: Sound Blaster Recon3Di
- Hard_Drive_Capacity: 500GB
- Corel programs: PSP: 8-2023
- Location: USA
Re: Trouble recording a script
Alright here you go. I've made the two changes, added GetNumber and put the result as the character of the text command. I'm assuming you've tested this script before posting so you know it'll work as you expect it to. I'm only adding the ability to confirm a new number. Nothing else about how this script functions has changed.
Code: Select all
from PSPApp import *
def ScriptProperties():
return {
'Author': u'',
'Copyright': u'',
'Description': u'',
'Host': u'PaintShop Pro',
'Host Version': u'22.00'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# Eraser
App.Do( Environment, 'Eraser', {
'BrushTip': {
'Shape': App.Constants.BrushShape.Rectangular,
'CustomBrush': None,
'Size': 100,
'Hardness': 100,
'Step': 1,
'Density': 100,
'Thickness': 100,
'Rotation': 0,
'BrushVariance': {
'SizeVariance': App.Constants.VarianceMethod.Pressure,
'SizeJitter': 0,
'OpacityVariance': App.Constants.VarianceMethod.None,
'OpacityJitter': 0,
'DensityVariance': App.Constants.VarianceMethod.None,
'DensityJitter': 0,
'ThicknessVariance': App.Constants.VarianceMethod.None,
'ThicknessJitter': 0,
'RotationVariance': App.Constants.VarianceMethod.None,
'RotationJitter': 0,
'PositionJitter': 0,
'UseScaledPositionJitter': False,
'ImpressionsPerStep': 1,
'FadeRate': 100
},
'BrushTrayShow': False
},
'Brush': {
'Opacity': 100,
'CAMG': {
'SupportCAMG': False,
'EngineType': App.Constants.CAMGEngineType.MagicWand,
'FeatherDegree': 0,
'AntiAliasing': 0,
'MagicWand': {
'MatchMode': App.Constants.MatchMode.None,
'Tolerance': 0,
'Contiguous': False
},
'Segmentation': {
},
'ObjectExtractor_PCA': {
}
}
},
'PrimaryMaterial': App.Constants.MaterialRef.Foreground,
'ForegroundMaterial': None,
'BackgroundMaterial': None,
'Stroke': [
(App.Constants.PathEntryInterpretation.Absolute,(885.5,2604.5),0),
(App.Constants.PathEntryInterpretation.Absolute,(888.5,2604.5),2015),
(App.Constants.PathEntryInterpretation.Absolute,(892.5,2604.5),2031),
(App.Constants.PathEntryInterpretation.Absolute,(904.5,2604.5),2031),
(App.Constants.PathEntryInterpretation.Absolute,(912.5,2604.5),2047),
(App.Constants.PathEntryInterpretation.Absolute,(924.5,2604.5),2047),
(App.Constants.PathEntryInterpretation.Absolute,(935.5,2604.5),2062),
(App.Constants.PathEntryInterpretation.Absolute,(947.5,2604.5),2062),
(App.Constants.PathEntryInterpretation.Absolute,(955.5,2604.5),2078),
(App.Constants.PathEntryInterpretation.Absolute,(967.5,2604.5),2078),
(App.Constants.PathEntryInterpretation.Absolute,(974.5,2604.5),2093),
(App.Constants.PathEntryInterpretation.Absolute,(982.5,2604.5),2093),
(App.Constants.PathEntryInterpretation.Absolute,(990.5,2604.5),2109),
(App.Constants.PathEntryInterpretation.Absolute,(994.5,2604.5),2125),
(App.Constants.PathEntryInterpretation.Absolute,(1006.5,2604.5),2125),
(App.Constants.PathEntryInterpretation.Absolute,(1010.5,2604.5),2140),
(App.Constants.PathEntryInterpretation.Absolute,(1017.5,2604.5),2140),
(App.Constants.PathEntryInterpretation.Absolute,(1021.5,2604.5),2156),
(App.Constants.PathEntryInterpretation.Absolute,(1029.5,2604.5),2156),
(App.Constants.PathEntryInterpretation.Absolute,(1033.5,2604.5),2172),
(App.Constants.PathEntryInterpretation.Absolute,(1041.5,2604.5),2172),
(App.Constants.PathEntryInterpretation.Absolute,(1045.5,2604.5),2187),
(App.Constants.PathEntryInterpretation.Absolute,(1049.5,2604.5),2203),
(App.Constants.PathEntryInterpretation.Absolute,(1053.5,2604.5),2203),
(App.Constants.PathEntryInterpretation.Absolute,(1056.5,2604.5),2218),
(App.Constants.PathEntryInterpretation.Absolute,(1060.5,2604.5),2234),
(App.Constants.PathEntryInterpretation.Absolute,(1064.5,2604.5),2250)
],
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'RandomSeed': 45044242,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
Result = App.Do( Environment, 'GetNumber', {
'DialogTitle': 'Number Entry',
'Prompt': 'Enter a Number',
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
}
})
# Text
App.Do( Environment, 'TextEx', {
'Visibility': True,
'CreateAs': App.Constants.CreateAs.Vector,
'Start': (978,2541),
'TextFlow': App.Constants.TextFlow.HorizontalDown,
'TextType': App.Constants.TextType.TextBase,
'Matrix': [
1,
0,
0,
0,
1,
0,
0,
0,
1
],
'AutoKern': True,
'Kerning': 0,
'Tracking': 0,
'Leading': 0,
'Font': u'Calibri',
'PointSize': 12,
'Italic': False,
'Bold': False,
'Underline': False,
'SuperScript': False,
'SubScript': False,
'Strikethru': False,
'AntialiasStyle': App.Constants.AntialiasEx.Sharp,
'WarpText': True,
'SetText': App.Constants.Justify.Center,
'Fill': None,
'Stroke': None,
'LineWidth': 0,
'LineStyle': {
'Name': u'',
'FirstCap': (u'Butt',0.25,0.25),
'LastCap': (u'Butt',0.25,0.25),
'FirstSegCap': (u'',0.25,0.25),
'LastSegCap': (u'',0.25,0.25),
'UseSegmentCaps': False,
'Segments': None
},
'Join': App.Constants.JointStyle.Miter,
'MiterLimit': 10,
'Characters': Result['EnteredNumber'],
'Strings': None,
'TextTarget': (0,0,[1],True),
'PathTarget': None,
'InObject': False,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'PreviewVisible': True,
'AutoProof': False,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# FileSave
App.Do( Environment, 'FileSave', {
'Encoding': {
'PNG': {
'Interlaced': False,
'OptimizedPalette': True,
'AlphaChannel': False
}
},
'FileName': u'',
'FileFormat': App.Constants.FileFormat.Unknown,
'PluginFormat': 0,
'WorkingMode': 0,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'DialogPlacement': {
'ShowMaximized': False,
'Rect': ((0,0), 0, 0)
},
'AutoActionMode': App.Constants.AutoActionMode.AllAlways,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
},
'DefaultProperties': []
})
# FileClose
App.Do( Environment, 'FileClose', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# SelectDocument
App.Do( Environment, 'SelectDocument', {
'SelectedImage': -1,
'Strict': False,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((22,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
https://levifiction.wordpress.com/
-
ayberry
- Posts: 3
- Joined: Wed Mar 18, 2020 4:32 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
- processor: Intel Core i7-7700
- ram: 16GB
- Video Card: GeForce GTX 1060 3GB
- Hard_Drive_Capacity: 1 TB
- Monitor/Display Make & Model: Samsung CF391
- Corel programs: PaintShop Pro 2020 Ultimate
Re: Trouble recording a script
Making progress, but still a step short.
The script stops and asks for input. I type the page number and click OK.
It moves to the next image and again I type the next page number, and so on.
But, the new number does not show up in the saved image. The old number has been erased but no new number shows.
I had said I did not need the Min and MaxValue lines, but I added them back in:
'DefaultValue': 0,
'MinValue': 1,
'MaxValue': 478,
I'm wondering if the command 'Characters': Result['EnteredNumber'], is not getting the result of my entry?
I ran my original script without the 'GetNumber' command and the old page number was erased and the new number was shown as "1"
Again, thank you for your help.
Artie
The script stops and asks for input. I type the page number and click OK.
It moves to the next image and again I type the next page number, and so on.
But, the new number does not show up in the saved image. The old number has been erased but no new number shows.
I had said I did not need the Min and MaxValue lines, but I added them back in:
'DefaultValue': 0,
'MinValue': 1,
'MaxValue': 478,
I'm wondering if the command 'Characters': Result['EnteredNumber'], is not getting the result of my entry?
I ran my original script without the 'GetNumber' command and the old page number was erased and the new number was shown as "1"
Again, thank you for your help.
Artie
Last edited by Kathy_9 on Sat Mar 21, 2020 2:41 pm, edited 1 time in total.
Reason: Removed email address to protect OP from spammers
Reason: Removed email address to protect OP from spammers
