LeviFiction wrote:Scripts can select materials. There is a command for that. But Brush size and shape, no. Only Presets can do that. However, I don't think scripts record changing materials.
I think they enter the material settings directly into the various editing commands.
If you want a script to select the color you will have to enter that command manually.
Code: Select all
App.Do(Environment, 'SetMaterial',{'IsPrimary':True, 'NewMaterial':{'Art': None, 'Color': (119, 247, 124), 'Pattern': None, 'Texture': None, 'Gradient': None}})
Color is defined with Red Green and Blue.
And of course Pattern, Texture, and Gradient all have their own settings.
Thanks, greatly appreciate your help. But I'm having no joy incorporating that into my existing script. I'm attempting to get it into the strict syntax that I gather is crucial. Most attempts gave me 'The script could not be loaded'. However one try did let it run but the Script Output finished with this error>
NameError: global name 'True' is not defined
That was with the script starting like this:
Code: Select all
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):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
})
# LeviFiction addition
App.Do(Environment, 'SetMaterial',{
'IsPrimary':True, 'NewMaterial':{
'Art': None, 'Color': (119, 247, 124), 'Pattern': None, 'Texture': None, 'Gradient': None
}
})
# NewDrawingObject
App.Do( Environment, 'NewDrawingObject', {
'Antialias': App.Constants.Boolean.true,
'MiterLimit': 15,
'Join': App.Constants.JointStyle.Miter,
'CreateAsVector': App.Constants.Boolean.false,
'Fill': None,
'LineStyle': {
'Name': u'',
'FirstCap': (u'Butt',7.21,7.21),
'LastCap': (u'Butt',1,1),
'FirstSegCap': None,
'LastSegCap': None,
'UseSegmentCaps': App.Constants.Boolean.false,
'Segments': None
},
'LineWidth': 6,
'Stroke': None,
'Path': None,
'ObjectName': u'New Shape',
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# NodeEditOffset
I'll now record an ultra simple script and try adding your code to that.
--------------------
Edit: Here's my simpler script after adding your code by copying the syntax of the rest. It failed with that same error about True not being defined.
Code: Select all
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):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
})
App.Do(Environment, 'SetMaterial',{
'IsPrimary':True,
'NewMaterial':{
'Art': None,
'Color': (255, 255, 219),
'Pattern': None,
'Texture': None,
'Gradient': None
}
})
# Selection
App.Do( Environment, 'Selection', {
'General': {
'Mode': App.Constants.SelectionOperation.Replace,
'Antialias': App.Constants.Boolean.false,
'Feather': 0
},
'SelectionShape': App.Constants.SelectionShape.Rectangle,
'Start': (49,18),
'End': (1442,41),
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
# ClearSelection
App.Do( Environment, 'ClearSelection', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})
--
Terry, East Grinstead, UK