7 Replies Latest reply on Dec 1, 2017 3:52 AM by AzatKhafizov

    Executing Sub-Action of Action in Photoshop via Script

    AzatKhafizov

      Hello everyone!

       

      I write script for animating of my work's process.

       

      So, idea is simple:

      I record my brush strokes with Actions. When work is done I execute script which calls these Actions and after each several brush strokes Photoshop exports numbered image for further video editing.

       

      At the moment I found only app.doAction("Action", "Action Set") command for Adobe ExtendScript Toolkit which executes whole action at once without controlling of subactions.

       

      Could you tell me, please, is there any command like app.doAction.doSubAction("SubAction", "Action", "Action Set") for executing suboperations of Action?

       

      For example, I want to export state of the painting after every 10 brush strokes inside certain Action. I need script something like this:

       

      var steps = 1000;

      var j = 0;

      var index = 0;

       

      for (i=1; i < steps; i++)

      {

           app.doAction.doSubAction(nextSubAction, "Action", "Action Set");

           j++;

           if (j == 9)

           {

                jpgFile = new File("d:/frame" + '0000'.substr(String(i).length) + index + ".jpg");

               saveOptions = new JPEGSaveOptions();

               saveOptions.embedColorProfile = true;

               saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;

               saveOptions.matte = MatteType.NONE;

               saveOptions.quality = 12;

               app.activeDocument.saveAs(jpgFile, saveOptions, true, Extension.LOWERCASE);

       

               j = 0;

               index ++;

           }

      }