3 Replies Latest reply on Nov 1, 2016 11:19 AM by DBarranca

    ActionManager: Auto-Select layer in the Move tool

    DBarranca Level 4

      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