2 Replies Latest reply on Dec 23, 2016 11:19 AM by RA5040ARD

    How to cancel or stop the action that called the script?

    RA5040ARD Level 1

      Hi,

      I would like to stop the action that called my script. I can see in the forum how to get the calling action name:

       

      1. var ref = new ActionReference(); 
      2. ref.putEnumerated( charIDToTypeID("Actn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );  
      3. var desc = executeActionGet(ref); 
      4. var actionName = desc.getString( charIDToTypeID("Nm  ") ); 
      5. var actionSetName = desc.getString( charIDToTypeID("PrNm") ); 
      6. alert( 'Current selected action is: '+actionName+'\rin the action set: '+actionSetName ); 

       

      Is there some way to stop the action? (What I'm doing in the script is giving the user the option to display help; if this option is chosen I display the help and would like to be able to terminate the action).

       

      Thanks!

       

      Robert

        • 1. Re: How to cancel or stop the action that called the script?
          JJMack Most Valuable Participant

          If a Action is running your script I would think if your script ends a throw and error the action would be in the action script step that user would see the error message like things went wrong the action should be stopped.  However once the users dismisses the error message the action would continue with its next step for actions can not use logic can not test if a script step worked or not even if the script was able to return a failed return code the action can not see that it can mot use logic to see that was the case.

           

          While your script is running it can interact with the user gives help receive information from the user do Photoshop steps because of info user provided. If there are additional steps in the action after the script step when your script ends the rest of the action will be played.

          • 2. Re: How to cancel or stop the action that called the script?
            RA5040ARD Level 1

            Yes, unfortunately I think you're right.  I will just need to put all of the steps in the scripts.

            Thanks

            Robert