Copy link to clipboard
Copied
Taking a stab at Action Manager code. I want to be able to set the antialiasing in the tool to none without having to set any text. Hence using AM code:
It's a wild stab in the dark with a blindfold on:
var idMk = charIDToTypeID( "Mk " );
var desc11046 = new ActionDescriptor();
var ref2274 = new ActionReference();
var idAntA = charIDToTypeID( "AntA" );
var idPrpr = charIDToTypeID( "Prpr" );
ref2274.putProperty( idPrpr, idAntA );
var idAnnt = charIDToTypeID( "Annt" );
var idAnno = charIDToTypeID( "Anno" );
var idantiAliasNone = stringIDToTypeID( "antiAliasNone" );
desc11046.putEnumerated( idAntA, idAnnt, idantiAliasNone );
executeAction( idMk, desc11046, DialogModes.NO );
Sadly, it doesn't work but I don't know why or where. Any ideas?
1 Correct answer
#target photoshop;
var s2t = stringIDToTypeID;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('currentToolOptions'));
r.putEnumerated(s2t('application'), s2t('ordinal'), s2t('targetEnum'));
var toolOptions = executeActionGet(r).getObjectValue(p),
characterOptions = toolOptions.getObjectValue(s2t('textToolCharacterOptions')),
textStyle = characterOptions.getObjectValue(s2t('textStyle'));
textStyle.putInteger(s2t('antiAlias'), 0);
characterOptions.putObject(s2t('text
...
Explore related tutorials & articles
Copy link to clipboard
Copied
Copy link to clipboard
Copied
This is setting text, or text tools. which is the same; but different 🙂
Copy link to clipboard
Copied
I don't understand what you need.
Copy link to clipboard
Copied
this guy solve your error
Copy link to clipboard
Copied
Reply if you are not SpamBot.
Copy link to clipboard
Copied
#target photoshop;
var s2t = stringIDToTypeID;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('currentToolOptions'));
r.putEnumerated(s2t('application'), s2t('ordinal'), s2t('targetEnum'));
var toolOptions = executeActionGet(r).getObjectValue(p),
characterOptions = toolOptions.getObjectValue(s2t('textToolCharacterOptions')),
textStyle = characterOptions.getObjectValue(s2t('textStyle'));
textStyle.putInteger(s2t('antiAlias'), 0);
characterOptions.putObject(s2t('textStyle'), s2t('textStyle'), textStyle);
toolOptions.putObject(s2t('textToolCharacterOptions'), s2t('null'), characterOptions);
(r = new ActionReference()).putClass(s2t('typeCreateOrEditTool'));
(d = new ActionDescriptor()).putReference(s2t('target'), r);
d.putObject(s2t('to'), s2t('target'), toolOptions);
executeAction(s2t('set'), d, DialogModes.NO);
Frst we need to find in which object the antiAlias ​​option is located (application -> currentToolOptions -> textToolCharacterOptions -> textStyle). In one of the recent threads @Stephen Marsh gave you a link where it was described in detail how to search for parameters. Then we sequentially collect the object in reverse order, i.e. first we put antiAlias ​​= 0 in textStyle, then we put textStyle in textToolCharacterOptions, and finally put textToolCharacterOptions in currentToolOptions (do not forget that in addition to the name of the object, we need to specify its classID - all this is available at the stage of searching for the desired variable). After we got the finished object, we simply assign it to the typeCreateOrEditTool class (name of current tool can be found at application -> tool)
Copy link to clipboard
Copied
Sadly, that fails on line 7. Running PS 19.16, if that helps
Copy link to clipboard
Copied
I only have the latest version installed (this is my mistake - I didn't check compatibility with older versions). Try that way:
#target photoshop;
var s2t = stringIDToTypeID;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('tool'));
r.putEnumerated(s2t('application'), s2t('ordinal'), s2t('targetEnum'));
var toolOptions = executeActionGet(r).getObjectValue(s2t('currentToolOptions')),
characterOptions = toolOptions.getObjectValue(s2t('textToolCharacterOptions')),
textStyle = characterOptions.getObjectValue(s2t('textStyle'));
textStyle.putInteger(s2t('antiAlias'), 0);
characterOptions.putObject(s2t('textStyle'), s2t('textStyle'), textStyle);
toolOptions.putObject(s2t('textToolCharacterOptions'), s2t('null'), characterOptions);
(r = new ActionReference()).putClass(s2t('typeCreateOrEditTool'));
(d = new ActionDescriptor()).putReference(s2t('target'), r);
d.putObject(s2t('to'), s2t('target'), toolOptions);
executeAction(s2t('set'), d, DialogModes.NO);
Copy link to clipboard
Copied
Sadly, that also didn't work.
Copy link to clipboard
Copied
add before main function
app.currentTool = 'typeCreateOrEditTool'
Most tools allow you to set options without switching to them directly, but with typeCreateOrEditTool, that trick doesn't seem to work 😞
Copy link to clipboard
Copied
Nice. That works, thank you!
Copy link to clipboard
Copied
var aa = 2
textStyle.putInteger(s2t('antiAlias'), aa);
Setting aa to 0, 1, & 2 I get None , Sharp & Strong respectively. However it seems to have skipped over Crisp & smooth. Values or 3 or above give none. What's that about?
Copy link to clipboard
Copied
None == 0
Sharp == 16
Crisp == 1
Strong == 2
Smooth == 8
Windows LCD == 64
Windows == 128
Perhaps a bitmask is used there 🤷
Copy link to clipboard
Copied
D'oh! Thank you once again.

