2 Replies Latest reply: Oct 15, 2013 2:02 AM by Alexey Danilchenko RSS

    Automation plugin as action and via File/Automate

    Alexey Danilchenko Community Member



      I have an Automation plugin that is scriptable (it has a number of exposed scriptable parameters and can be recorded and run from Actions palette). The plugin displayes the UI when it is called interactively (from File/Automate).


      I am however having troubles distinguishing when it is called from an Action palette as a playback of recorded action and when it actually was called interactively from File/Automate (testing it in Photoshop CS6). On plugin invocation I check passed action descriptor and if not empty, read parameters from it and don't show the UI. On the call end, I write script parameters back to a descriptor to be able to use them in recorded action. With this in mind, after PS start first time selecting File/Automate works as expected - no descriptor/parameters passed into the plugin. But after a first call, Photoshop seems to keep the descriptor/parameters written at the end of the plugin and passes it on subsequent user invoked File/Automate. The same happens if plugin is getting called from a recorded action playback (and its expected). Basically after a first invocaction, the plugin will always receive action descriptor whether it called from an action playback or invoked by user.


      I need to distinguish these two cases and basically present UI/start from scratch when user invokes it and use the passed action parameters when action plays it. I have not found anything in SDK to point me to the solution so I'd appreciate the help.


      In filter plugins I can at least get selector start when invoked from UI and use that to free/ignore the action descriptor data.

        • 1. Re: Automation plugin as action and via File/Automate
          Tom Ruark Adobe Employee

          I don't think you should care. The option you do care about is this one:

          PIDialogPlayOptions playInfo

          That is part of  PIActionParameters *actionParameters

          That is part of your PSActionsPlugInMessage that comes into your automation plugin entrypoint.


          This parameter has three options:

          a) always display the dialog,

          b) only display the dialog if you don't like the parameters you are given,

          c) never display a dialog (either return an error or proceed with best options but don't stop with a dialog)


          From the file menu, user selected, you should get option a (always). From the actions panel you should get option a or b. From scripting you can get all three options.


          There is also a property in PIProperties.h called propPlayInProgress but the above information should be what you need to do the correct thing with dialogs.

          • 2. Re: Automation plugin as action and via File/Automate
            Alexey Danilchenko Community Member

            Thanks - using play options did the trick. I knew I was missing something obvious