This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > PainShop Pro Scripting > October 2007 > Working script fails in batch





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Working script fails in batch
altis

2007-10-10, 6:18 pm


I'm fairly new to scripting with PSP9. I've created a script by
recording different bits and pieces and then pasting them together in a
new file. It adds a nice frame and the EXIF details to my photos but it
fails with "Unknown error occurred with command NewDrawingObject" when
I try to use it in batch mode.

The full script output is:
Code:
--------------------
Executing Gaussian Blur
Executing Colour Adjust Brightness Contrast
Executing Copy
Executing PasteAsNewLayer
Executing SelectLayer
Executing LayerViewCurrentOnly
Executing LayerSetVisibility
Executing Resize
Executing ResizeCanvas
Executing SelectAll
Executing Contract Selection
Executing ClearSelection
Executing Cut
Executing SelectNone
Executing DeleteLayer
Executing LayerArrangeToBottom
Executing LayerArrange
Executing New Raster Layer
Executing SelectLayer
Executing Fill
Executing LayerArrangeToBottom
Executing LayerArrange
Executing New Vector Layer
Executing SelectLayer
Executing Text
Executing NewDrawingObject
Unknown error occurred with command NewDrawingObject
Traceback (most recent call last):
File "F:\My PSP Files\Scripts-Restricted\blurframe5b.PspScript", line 464, in Do
App.Do( Environment, 'NewDrawingObject', {
RuntimeError: The script could not be executed.

Script 'blurframe5b' has completed with an error.
--------------------


The relevant bit of script is:
Code:
--------------------
#################################################################
# Add Photo Details #
#################################################################

# New Text Layer
App.Do( Environment, 'NewVectorLayer', {
'General': {
'Opacity': 100,
'Name': u'TextLayer',
'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.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((9,0,1),1)
}
})

# Text
App.Do( Environment, 'TextEx', {
'Visibility': True,
'CreateAs': App.Constants.CreateAs.Vector,
'Start': (0,0),
'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'Palatino Linotype Italic',
'PointSize': 48,
'Italic': False,
'Bold': False,
'Underline': False,
'Strikethru': False,
'AntialiasStyle': App.Constants.AntialiasEx.Sharp,
'WarpText': True,
'SetText': App.Constants.Justify.Left,
'Fill': {
'Color': (128,128,128),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'Stroke': {
'Color': (0,0,0),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'LineWidth': 0,
'LineStyle': {
'Name': u'',
'FirstCap': (u'',0.25,0.25),
'LastCap': (u'',0.25,0.25),
'FirstSegCap': (u'',0.25,0.25),
'LastSegCap': (u'',0.25,0.25),
'UseSegmentCaps': False,
'Segments': []
},
'Join': App.Constants.JointStyle.Miter,
'MiterLimit': 20,
'Characters': TextRight,
'Strings': None,
'TextTarget': (0,0,[1],True),
'PathTarget': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((9,0,1),1)
}
})

# NewDrawingObject
App.Do( Environment, 'NewDrawingObject', { ###FAILS HERE ###
'Antialias': True,
'MiterLimit': 15,
'Join': App.Constants.JointStyle.Miter,
'CreateAsVector': True,
'Fill': {
'Color': (0,0,0),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'LineStyle': {
'Name': u'',
'FirstCap': (u'Butt',7.21,7.21),
'LastCap': (u'Butt',1,1),
'FirstSegCap': None,
'LastSegCap': None,
'UseSegmentCaps': False,
'Segments': None
},
'LineWidth': 0,
'Stroke': {
'Color': (0,0,0),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'Path': None,
'ObjectName': u'New Path',
'Visibility': True,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((9,0,1),1)
}
})

# NodeEditOffset
App.Do( Environment, 'NodeEditOffset', {
'NodeEditOffsetPoint': (0,440-App.ActiveDocument.Height),
'NodeEditAddPoint': (App.ActiveDocument.Width-90,App.ActiveDocument.Height-220),
'NodeEditNodeOffsetControlKeyState': False,
'NodeEditNodeOffsetShiftKeyState': True,
'NodeEditNodeOffsetAddNode': True,
'NodeEditNodeOffsetPart': 0,
'NodeEditNodeOffsetDoLine': True,
'NodeEditContinuous': False,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((9,0,1),1)
}
})

# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (0,0,[1],False),
'Type': App.Constants.ObjectSelection.AddToSelection,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((9,0,1),1)
}
})

# FitTextToPath
App.Do( Environment, 'FitTextToPath', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((9,0,1),1)
}
})

# Vector Align Bottom
App.Do( Environment, 'VectorAlignBottom', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((9,0,1),1)
}
})

--------------------


Sponsored Links


Copyright 2003 - 2009 forum4designers.com  Software forum  Computer Hardware reviews