I had two separately recorded scripts which worked OK consistently. I was trying to simply combine them in my text editor. But after some hours I gave up because the results either wouldn't run at all or, strangely, did only the second part, ignoring the first.
Anyway, so I carefully re-recorded all the steps as one single script. It worked perfectly on the one test I did and I finally went to bed.
But on trying it again this morning it fails, giving this error:

Here is the full Script Output:
Executing RunScript
Executing ColorReplacer
Executing UndoLastCmd
Executing ColorReplacerAll
Executing Magic Wand
------- Command Execution Failed -----------
Command Name: Magic Wand
Error Text: Internal program error: An invalid parameter has been passed to a function
Traceback (most recent call last):
File "C:\Docs\My PSP8 Files\Scripts-Trusted\Elevation-Edit-Combined-3.PspScript", line 98, in Do
App.Do( Environment, 'MagicWand', {
JascApp.InvalidParameterType: Invalid parameter type (parameter )
Can anyone suggest why this now fails and how to fix it please?
In brief, this is what it does:
1. Uses Colour Replacer to replace greyish dashes with green, thus removing them from the green area.
2a. Selects the green with magic wand.
2b. Expands the selection by 1 pixel, therefore now including the 1 pixel black border that I want to keep.
2c. Inverts the selection, which is therefore now the yellow, the numbers, and the remaining greyish dashes.
2d. Fills that with a new very pale blue colour.
2e. Uses Ctrl+D to remove the selection marquee.
And here is the script:
from JascApp import *
def ScriptProperties():
return {
'Author': u'Terry Pinnell',
'Copyright': u'',
'Description': u'',
'Host': u'Paint Shop Pro',
'Host Version': u'8.10'
}
def Do(Environment):
# ColorReplacer
App.Do( Environment, 'ColorReplacer', {
'BrushTip': {
'BrushVariance': {
'SizeVariance': App.Constants.VarianceMethod.None,
'SizeJitter': 0,
'DensityVariance': App.Constants.VarianceMethod.None,
'DensityJitter': 0,
'RotationVariance': App.Constants.VarianceMethod.None,
'RotationJitter': 0,
'ThicknessVariance': App.Constants.VarianceMethod.None,
'ThicknessJitter': 0,
'FadeRate': 100,
'PositionJitter': 0,
'UseScaledPositionJitter': App.Constants.Boolean.false,
'ImpressionsPerStep': 1
},
'Shape': App.Constants.BrushShape.Round,
'CustomBrush': None,
'Size': 12,
'Hardness': 100,
'Density': 100,
'Rotation': 0,
'Thickness': 100,
'Step': 25
},
'Brush': {
},
'PrimaryMaterial': App.Constants.MaterialRef.Foreground,
'ForegroundMaterial': {
'Color': (189,255,184),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Identity': u'Material'
},
'BackgroundMaterial': {
'Color': (128,128,128),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Identity': u'Material'
},
'Stroke': [
(App.Constants.PathEntryInterpretation.Absolute,(10.5,32.5),0)
],
'Tolerance': 20,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'RandomSeed': 81631906,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# UndoLastCmd
App.Do( Environment, 'UndoLastCmd', {
})
# ColorReplacerAll
App.Do( Environment, 'ColorReplacerAll', {
'PrimaryMaterial': App.Constants.MaterialRef.Foreground,
'ForegroundMaterial': {
'Color': (189,255,184),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Identity': u'Material'
},
'BackgroundMaterial': {
'Color': (128,128,128),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Identity': u'Material'
},
'Tolerance': 20,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# Magic Wand
App.Do( Environment, 'MagicWand', {
'General': {
'Mode': App.Constants.SelectionOperation.Replace,
'Antialias': App.Constants.Boolean.false,
'Feather': 0,
'SampleMerged': App.Constants.Boolean.false
},
'MatchMode': App.Constants.MatchMode.RGBValue,
'Point': (831.5,479.5),
'Tolerance': 10,
'AntialiasType': App.Constants.AntialiasType.Outside,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# Expand Selection
App.Do( Environment, 'SelectExpand', {
'ExpandAmount': 1,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# SelectInvert
App.Do( Environment, 'SelectInvert', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# Fill
App.Do( Environment, 'Fill', {
'BlendMode': App.Constants.BlendMode.Normal,
'MatchMode': App.Constants.MatchMode.None,
'Material': {
'Color': (235,255,253),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Identity': u'Material'
},
'UseForground': App.Constants.Boolean.true,
'Opacity': 100,
'Point': (11.5,30.5),
'SampleMerged': App.Constants.Boolean.false,
'Tolerance': 20,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# SelectNone
App.Do( Environment, 'SelectNone', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
