In PSP 8 I recorded a trivial script (pasted in full below) to add some arbitrary text and centre it horizontally. (Despite its simplicity it generated an astonishing amount of code!) It works as expected.
But can anyone show me how to edit this so that instead of that specific text string it will add whatever text is on the Windows clipboard please?
Code: Select all
# This script was recorded. I simply added some arbitary text 'My added text' and horizontally centered it.
# Font size seems to be specified in lines 44 and 82
# And text string specified in line 95; its position appears to be in lines 46 & 84, although I don't know how to relate the numbers '820.5,220.5' to the actual position I see in the image.
from JascApp import *
def ScriptProperties():
return {
'Author': u'',
'Copyright': u'',
'Description': u'',
'Host': u'Paint Shop Pro',
'Host Version': u'8.10'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
})
# Text
App.Do( Environment, 'Text', {
'CreateAs': App.Constants.CreateAs.Vector,
'Segments': [{
'Bold': App.Constants.Boolean.true,
'Fill': {
'Color': (0,0,0),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Identity': u'Material'
},
'Font': u'Arial',
'LineStyle': {
'Name': u'',
'FirstCap': (u'Butt',0.25,0.25),
'LastCap': (u'Butt',0.25,0.25),
'FirstSegCap': (u'',0.25),
'LastSegCap': (u'',0.25),
'UseSegmentCaps': App.Constants.Boolean.false,
'Segments': []
},
'LineWidth': 0,
'PointSize': 20, # Font size specified here (and also in line 82)
'SetText': App.Constants.Justify.Center,
'Start': (820.5,220.5), # Text position seems to be set here. Oddly with pixels that are not simple integers, but always with the decimal '0.5'. Also line 84?
'Stroke': {
'Color': (255,255,255),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Identity': u'Material'
}
},{
'Antialias': App.Constants.Boolean.true,
'WarpText': App.Constants.Boolean.true,
'AutoKern': App.Constants.Boolean.true,
'Bold': App.Constants.Boolean.true,
'Kerning': 0,
'Leading': 0,
'Fill': {
'Color': (0,0,0),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Identity': u'Material'
},
'Font': u'Arial',
'Italic': App.Constants.Boolean.false,
'Join': App.Constants.JointStyle.Miter,
'LineStyle': {
'Name': u'',
'FirstCap': (u'Butt',0.25,0.25),
'LastCap': (u'Butt',0.25,0.25),
'FirstSegCap': (u'',0.25),
'LastSegCap': (u'',0.25),
'UseSegmentCaps': App.Constants.Boolean.false,
'Segments': []
},
'LineWidth': 0,
'MiterLimit': 10,
'PointSize': 20, # Font size specified here (and also in line 44)
'SetText': App.Constants.Justify.Center,
'Start': (820.5,220.5), # LH end of text position?
'Strikethru': App.Constants.Boolean.false,
'Stroke': {
'Color': (255,255,255),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Identity': u'Material'
},
'Underline': App.Constants.Boolean.false
},{
'Characters': u'My added text' # Text is added here
}],
'SavedText': None,
'FinalApply': App.Constants.Boolean.false,
'Matrix': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# VectorAlignHCenterInCanvas
App.Do( Environment, 'VectorAlignHCenterInCanvas', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
Terry, East Grinstead, UK


