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 ++;
}
}
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
Copy link to clipboard
Copied
Moving to Photoshop Scripting
Copy link to clipboard
Copied
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.
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.
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); }
}
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:
Copy link to clipboard
Copied
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.