Copy link to clipboard
Copied
Hi,
I'm trying to switch true/false the Auto-Select option in the Move Tool.
Which seems to be buried in the "currentToolOptions", as the "AtSl" CharID:
var ref = new ActionReference ();
ref.putEnumerated (stringIDToTypeID ("application"), stringIDToTypeID ("ordinal"), stringIDToTypeID ("targetEnum"));
var appDesc = executeActionGet(ref)
var currentToolOptions = appDesc.getObjectValue (stringIDToTypeID ("currentToolOptions"));
$.writeln(currentToolOptions.getBoolean(charIDToTypeID('AtSl'))); // true or false
I've tried the following (extract the actual currentToolOptions descriptor, then set it in the application), to no avail:
var ref = new ActionReference ();
ref.putEnumerated (stringIDToTypeID ("application"), stringIDToTypeID ("ordinal"), stringIDToTypeID ("targetEnum"));
var appDesc = executeActionGet(ref)
var currentToolOptions = appDesc.getObjectValue (stringIDToTypeID ("currentToolOptions"));
$.writeln(currentToolOptions.getBoolean(charIDToTypeID('AtSl')));
// Setting true
currentToolOptions.putBoolean(charIDToTypeID('AtSl'), true)
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( stringIDToTypeID( "currentToolOptions" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
desc.putReference( charIDToTypeID( "null" ), ref );
desc.putObject( stringIDToTypeID('to'), stringIDToTypeID( "currentToolOptions" ), currentToolOptions );
executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO );
General Photoshop error, blabla.
Where am I wrong? The usual suspect who finds solutions to my AM code is Mikaeru69​ 🙂 but anyone contribution is more than welcome.
Thank you!
Davide
Tom Ruark​, I didn't know you have a repository on GitHub, immediately starred 🙂
I've been able to borrow code from the example you pointed me to, and in fact the solution is much simpler than I thought:
...var d = new ActionDescriptor();
var r = new ActionReference();
r.putClass(stringIDToTypeID("moveTool"))
d.putReference(stringIDToTypeID("null"), r);
var d2 = new ActionDescriptor();
d2.putBoolean(charIDToTypeID('AtSl'), true);
d.putObject(stringIDToTypeID("to"),stringIDToTyp
Copy link to clipboard
Copied
Hi Davide,
As far as I know, you can get the current tool options but unfortunately not set them, or at least I've always failed miserably although I tried many AM code combinations. You best shot indeed is probably to use tool presets...
Re: changing crop tool settings with actiondescriptor code
HTH,
--The usual Mikaeru... 😉
Copy link to clipboard
Copied
Get the SetPaintBrushOpacityAndOthers.jsx found here: GitHub - TomRuark/JavaScripts: All my JavaScripts
Each tool is different for the setting part but all the tools should respond to the get correctly. Let me know if you have trouble with the "set" on a particular tool and I'll try to work up an example.
Copy link to clipboard
Copied
Tom Ruark​, I didn't know you have a repository on GitHub, immediately starred 🙂
I've been able to borrow code from the example you pointed me to, and in fact the solution is much simpler than I thought:
var d = new ActionDescriptor();
var r = new ActionReference();
r.putClass(stringIDToTypeID("moveTool"))
d.putReference(stringIDToTypeID("null"), r);
var d2 = new ActionDescriptor();
d2.putBoolean(charIDToTypeID('AtSl'), true);
d.putObject(stringIDToTypeID("to"),stringIDToTypeID("null"),d2)
executeAction(stringIDToTypeID("set"),d,DialogModes.NO)
Thank you very much!!
Davide
Copy link to clipboard
Copied
Everyone is making this too hard:
Select 'move' tool - "V" If you can't find it 'move' and 'artboard' share the V slot in your toolbox.
Check the box to auto-select layer/group.
Un-check the box to 'Ctrl' select layer/group.
Copy link to clipboard
Copied
Hi p2cobra​,
you are a new user. Welcome.
But:
Everyone here knows the manual way.
This is the scripting forum.
Please be sure that you are writing in the right forum and please don't hijack older threads.
Have fun