Here is a script that was made by recording and was recorded OK with no errors during the recording. Once played back however, the script fails at the layerarrange step with the following error:
The arrange command is not valid in the current program state.
Any suggestions??
Here is the script.
from PSPApp import *
def ScriptProperties():
return {
'Author': u'',
'Copyright': u'',
'Description': u'',
'Host': u'PaintShop Pro',
'Host Version': u'24.00'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (0,1,[],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((24,0,0),1)
}
})
# Magic Wand
App.Do( Environment, 'MagicWand', {
'General': {
'Mode': App.Constants.SelectionOperation.Replace,
'Antialias': False,
'Feather': 0,
'SampleMerged': True
},
'MatchMode': App.Constants.MatchMode.Color,
'Contiguous': True,
'Point': (202.5,86.5),
'Tolerance': 20,
'AntialiasType': App.Constants.AntialiasType.Outside,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# New Raster Layer
App.Do( Environment, 'NewRasterLayer', {
'General': {
'Opacity': 100,
'Name': u'Raster 3',
'IsVisible': True,
'IsTransparencyLocked': False,
'LinkSet': 0,
'UseHighlight': False,
'PaletteHighlightColor': (255,255,64),
'GroupLink': True,
'BlendMode': App.Constants.BlendMode.Normal
},
'BlendRanges': {
'BlendRangeGreen': (0,0,255,255,0,0,255,255),
'BlendRangeRed': (0,0,255,255,0,0,255,255),
'BlendRangeBlue': (0,0,255,255,0,0,255,255),
'BlendRangeGrey': (0,0,255,255,0,0,255,255)
},
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (0,-2,[],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((24,0,0),1)
}
})
# Copy
App.Do( Environment, 'Copy', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (0,2,[],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((24,0,0),1)
}
})
# PasteIntoSelection
App.Do( Environment, 'PasteIntoSelection', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# New Layer Group
App.Do( Environment, 'NewLayerGroup', {
'General': {
'Opacity': 100,
'Name': u'Group 1',
'IsVisible': True,
'IsTransparencyLocked': False,
'LinkSet': 0,
'UseHighlight': False,
'PaletteHighlightColor': (255,255,64),
'GroupLink': True,
'BlendMode': App.Constants.BlendMode.Normal
},
'BlendRanges': {
'BlendRangeGreen': (0,0,255,255,0,0,255,255),
'BlendRangeRed': (0,0,255,255,0,0,255,255),
'BlendRangeBlue': (0,0,255,255,0,0,255,255),
'BlendRangeGrey': (0,0,255,255,0,0,255,255)
},
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (0,-1,[],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((24,0,0),1)
}
})
# SelectNone
App.Do( Environment, 'SelectNone', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# Magic Wand
App.Do( Environment, 'MagicWand', {
'General': {
'Mode': App.Constants.SelectionOperation.Replace,
'Antialias': False,
'Feather': 0,
'SampleMerged': True
},
'MatchMode': App.Constants.MatchMode.Color,
'Contiguous': True,
'Point': (478.5,102.5),
'Tolerance': 20,
'AntialiasType': App.Constants.AntialiasType.Outside,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# New Raster Layer
App.Do( Environment, 'NewRasterLayer', {
'General': {
'Opacity': 100,
'Name': u'Raster 4',
'IsVisible': True,
'IsTransparencyLocked': False,
'LinkSet': 0,
'UseHighlight': False,
'PaletteHighlightColor': (255,255,64),
'GroupLink': True,
'BlendMode': App.Constants.BlendMode.Normal
},
'BlendRanges': {
'BlendRangeGreen': (0,0,255,255,0,0,255,255),
'BlendRangeRed': (0,0,255,255,0,0,255,255),
'BlendRangeBlue': (0,0,255,255,0,0,255,255),
'BlendRangeGrey': (0,0,255,255,0,0,255,255)
},
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (0,-2,[],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((24,0,0),1)
}
})
# Copy
App.Do( Environment, 'Copy', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (0,2,[],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((24,0,0),1)
}
})
# PasteIntoSelection
App.Do( Environment, 'PasteIntoSelection', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# LayerArrange
App.Do( Environment, 'LayerArrange', {
'Path': (0,1,[1],False),
'MoveAboveSibling': False,
'Path': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((24,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (0,1,[1],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((24,0,0),1)
}
})
# LayerStylesCopy
App.Do( Environment, 'LayerStylesCopy', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (1,-1,[],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((24,0,0),1)
}
})
# LayerStylesPaste
App.Do( Environment, 'LayerStylesPaste', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((24,0,0),1)
}
})
layer arrange command does not seem to be working
Moderator: Kathy_9
-
- Posts: 9
- Joined: Tue Aug 14, 2018 2:53 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
-
- Advisor
- Posts: 6546
- 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: layer arrange command does not seem to be working
There appears to be a small typo/bug in the recording of the LayerArrange command. It has an extra path parameter that tells it to do nothing.
Just remove that one line in the "LayerArrange" command and it should work just fine.
The final version of the "LayerArrange" command should look like this
Code: Select all
'Path': None,
The final version of the "LayerArrange" command should look like this
Code: Select all
# LayerArrange
App.Do( Environment, 'LayerArrange', {
'Path': (0,1,[1],False),
'MoveAboveSibling': False,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((24,0,0),1)
}
})
-
- Posts: 9
- Joined: Tue Aug 14, 2018 2:53 pm
- System_Drive: C
- 32bit or 64bit: 64 Bit
Re: layer arrange command does not seem to be working
Great. Thanks. I'm new to python and PSP scripting. I must have looked at that command for 30 minutes or more the other day trying to figure out why it was not working. I figured the path was wrong somehow and focusing on that, I didn't even see that there was another path command.
Thanks for the catch...
Thanks for the catch...