• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ActionManager: Auto-Select layer in the Move tool

Advocate ,
Oct 30, 2016 Oct 30, 2016

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

TOPICS
Actions and scripting

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Nov 01, 2016 Nov 01, 2016

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

...

Votes

Translate

Translate
Adobe
Guest
Oct 30, 2016 Oct 30, 2016

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: moveTool options

Re: changing crop tool settings with actiondescriptor code

HTH,

--The usual Mikaeru... 😉

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Oct 31, 2016 Oct 31, 2016

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 01, 2016 Nov 01, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 02, 2019 May 02, 2019

Copy link to clipboard

Copied

LayerSelect.pngVtools.png

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 02, 2019 May 02, 2019

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines