what codes do i need to make a loop that repeats a functioning such as drawing a line more than 1 time? this script was recorded only drawing a straight line and i would like to loop the same line being drawn multiple times.
and if you know how to do that, then how do you do calculations within this script? i know this is a modified Python code, but it looks similar to commodore 64 basic language, which i was very good at doing.
from PSPApp import *
def ScriptProperties():
return {
'Author': u'',
'Copyright': u'',
'Description': u'',
'Host': u'PaintShop Pro',
'Host Version': u'19.00'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((19,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# PaintBrush
App.Do( Environment, 'PaintBrush', {
'BrushTip': {
'Shape': App.Constants.BrushShape.Round,
'CustomBrush': u'feather',
'Size': 11,
'Hardness': 100,
'Step': 32,
'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,
'ColorBlendVariance': App.Constants.VarianceMethod.None,
'ColorBlendJitter': 0,
'HueVariance': App.Constants.VarianceMethod.None,
'HueJitter': 0,
'SaturationVariance': App.Constants.VarianceMethod.None,
'SaturationJitter': 0,
'LightnessVariance': App.Constants.VarianceMethod.None,
'LightnessJitter': 0,
'PositionJitter': 0,
'UseScaledPositionJitter': False,
'ImpressionsPerStep': 1,
'FadeRate': 100
},
'BrushTrayShow': False
},
'Brush': {
'Opacity': 100,
'ContinuousPaint': False,
'WetLookPaint': False,
'BlendMode': App.Constants.BlendMode.Normal,
'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': {
'Color': (0,0,0),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'BackgroundMaterial': {
'Color': (255,255,255),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'Stroke': [
(App.Constants.PathEntryInterpretation.Absolute,(292.5,571.5),0),
(App.Constants.PathEntryInterpretation.Absolute,(292.5,571.5),31)
],
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'RandomSeed': 30840411,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((19,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
# PaintBrush
App.Do( Environment, 'PaintBrush', {
'BrushTip': {
'Shape': App.Constants.BrushShape.Round,
'CustomBrush': u'feather',
'Size': 11,
'Hardness': 100,
'Step': 32,
'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,
'ColorBlendVariance': App.Constants.VarianceMethod.None,
'ColorBlendJitter': 0,
'HueVariance': App.Constants.VarianceMethod.None,
'HueJitter': 0,
'SaturationVariance': App.Constants.VarianceMethod.None,
'SaturationJitter': 0,
'LightnessVariance': App.Constants.VarianceMethod.None,
'LightnessJitter': 0,
'PositionJitter': 0,
'UseScaledPositionJitter': False,
'ImpressionsPerStep': 1,
'FadeRate': 100
},
'BrushTrayShow': False
},
'Brush': {
'Opacity': 100,
'ContinuousPaint': False,
'WetLookPaint': False,
'BlendMode': App.Constants.BlendMode.Normal,
'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': {
'Color': (0,0,0),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'BackgroundMaterial': {
'Color': (255,255,255),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'Stroke': [
(App.Constants.PathEntryInterpretation.Absolute,(292.5,571.5),0),
(App.Constants.PathEntryInterpretation.Absolute,(1465.5,556.5),0)
],
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'RandomSeed': 30842144,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((19,0,0),1),
'PreviewMode': 1,
'ScreenControl': 1
}
})
Recording/Modifying/Writing Scripts LOOPS
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: Recording/Modifying/Writing Scripts LOOPS
It's not even modified, Python. It's pure python. The "from PSPApp import *" is what imports the App.Do() function and other objects/constants for use in a script. But technically, so long as you put your code inside the "Do" function it'll run anything.
For loops in python are pretty easy if you want to loop only a specific number of times. If you want to loop based on input that'll be the while loop.
For loops in python are pretty easy if you want to loop only a specific number of times. If you want to loop based on input that'll be the while loop.
Code: Select all
for x in range(10): #runs the loop 10 times, setting x = 0...10
#Add PaintBrush command here
[code]
Now, you want to make a whole bunch of lines, but in what sort of pattern? How you do it depends on what you want it to do. If you only want to build up the exact same line in the exact same spot several times, you don't need any calculations.https://levifiction.wordpress.com/
