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

Executing Sub-Action of Action in Photoshop via Script

Community Beginner ,
Nov 02, 2017 Nov 02, 2017

Copy link to clipboard

Copied

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 ++;

     }

}

TOPICS
Actions and scripting

Views

1.8K

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

People's Champ , Nov 29, 2017 Nov 29, 2017

Examples of using:

play_action("Set 1", "Action 1") // Perform the whole action

play_action("Set 1", "Action 1", 4, true) // Complete all from the beginning of the command number 4

play_action("Set 1", "Action 1", 5, false) // Will execute only command number 5

// cmd_number - the index of the command, ( starts from 1 )

function play_action(set, action, cmd_number, allow_continue)

    {

    try

        {

        var d = new ActionDescriptor();

        var r = new ActionReference();

        if (typeof(cmd_n

...

Votes

Translate

Translate
Adobe
Nov 28, 2017 Nov 28, 2017

Copy link to clipboard

Copied

Moving to Photoshop Scripting​

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 Beginner ,
Dec 01, 2017 Dec 01, 2017

Copy link to clipboard

Copied

LATEST

Akash Sharma, thank you for moving this thread in the right category!

In fact, it was the strong reason why r-bin could see the theme in the threads' list and could help with the solution.

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 ,
Nov 28, 2017 Nov 28, 2017

Copy link to clipboard

Copied

I don't believe so. The best you can do is break down your actions into small steps, then reference them.

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
People's Champ ,
Nov 29, 2017 Nov 29, 2017

Copy link to clipboard

Copied

Examples of using:

play_action("Set 1", "Action 1") // Perform the whole action

play_action("Set 1", "Action 1", 4, true) // Complete all from the beginning of the command number 4

play_action("Set 1", "Action 1", 5, false) // Will execute only command number 5

// cmd_number - the index of the command, ( starts from 1 )

function play_action(set, action, cmd_number, allow_continue)

    {

    try

        {

        var d = new ActionDescriptor();

        var r = new ActionReference();

        if (typeof(cmd_number) == "number") r.putIndex( charIDToTypeID( "Cmnd" ), cmd_number );

        r.putName( charIDToTypeID( "Actn" ), action );

        r.putName( charIDToTypeID( "ASet" ), set );

        d.putReference( charIDToTypeID( "null" ), r );

        if (typeof(allow_continue) == "boolean") d.putBoolean( charIDToTypeID( "Cntn" ), allow_continue );

        executeAction( charIDToTypeID( "Ply " ), d, DialogModes.NO );

        }

    catch(e) { alert(e); }

    }

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 Beginner ,
Dec 01, 2017 Dec 01, 2017

Copy link to clipboard

Copied

r-bin, your answer was absolutely helpful!

Thank you very much!

Now I record process of creation of my paintings.

Here is result of using your script combined with my approach from initial post:

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
Engaged ,
Nov 30, 2017 Nov 30, 2017

Copy link to clipboard

Copied

Hi AzatKhafizov

Hope this link will Help...

Play Palette Action | Tonton Pixel

-yajiv

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 Beginner ,
Dec 01, 2017 Dec 01, 2017

Copy link to clipboard

Copied

natrev, thank you for the script!

It is a little bit different from the thing that I needed, but in fact it's also useful for work.

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