Copy link to clipboard
Copied
Hello,
The line width tool can be decreased/increased with [ and ], but unlike the brush size, its value increases just by 1 pixel regardless of the current value.
I wanted to write a function to decrease/increase depending on the current value just like the brush tool. Although I was able to read the current value, I found no way to change it programmatically.
#target photoshop
s2t = stringIDToTypeID;
c2t = charIDToTypeID;
if (currentTool == 'lineTool') {
//get current tool property from application
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('tool'));
r.putEnumerated(s2t('application'), s2t('ordinal'), s2t('targetEnum'));
// get and save currentToolOptions object from tool property
var cto = executeActionGet(r).getObjectValue(s2t('currentToolOptions'));
// get and save LnWd integer from currentToolOptio...
Copy link to clipboard
Copied
#target photoshop
s2t = stringIDToTypeID;
c2t = charIDToTypeID;
if (currentTool == 'lineTool') {
//get current tool property from application
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('tool'));
r.putEnumerated(s2t('application'), s2t('ordinal'), s2t('targetEnum'));
// get and save currentToolOptions object from tool property
var cto = executeActionGet(r).getObjectValue(s2t('currentToolOptions'));
// get and save LnWd integer from currentToolOptions
var lineWidth = cto.getInteger(c2t('LnWd'));
// put new size to saved currentToolOptions
cto.putInteger(c2t('LnWd'), lineWidth + 5);
// describe 'path' to the object with which we will perform actions
(r = new ActionReference()).putClass(s2t(currentTool));
(d1 = new ActionDescriptor()).putReference(s2t('target'), r);
// put object that we pass along this 'path'
d1.putObject(s2t('to'), s2t('target'), cto);
// perform the set command
executeAction(s2t('set'), d1, DialogModes.NO);
}* try to understand how it works to achieve better results in the future
** you can read a little about how to explore built-in objects here Action Manager Scripting
Copy link to clipboard
Copied
Great! thank you very much. I'm relying mostly on recording actions and exporting their code via xtools or on scriptlistener, but these alone do not provide all the control I'm looking for. I definitely need to read more about built-in objects. thank you for the links
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more