Skip to main content
Participating Frequently
February 28, 2021
Question

Script to play all actions in a set against a single image

  • February 28, 2021
  • 3 replies
  • 1610 views

All, I would appreciate any thoughts on running all actions within a set against a single image eg: if I have Action Set = Black-White with Actions of say Matt Finish, Silhouette, High Contrast and Low Contrast the goal is to play them against the Active Document. For clarity I do not mean play those Actions against various Images. Thanks.

This topic has been closed for replies.

3 replies

Legend
March 1, 2021

Do you just need to play all actions from a certain set?

 

#target photoshop

var s2t = stringIDToTypeID,
    w = new Window("dialog {text: 'Select action set', orientation: 'column', alignChildren: ['center','top']}"),
    l = w.add("listbox{helpTip: 'double click to play all actions', preferredSize: [250, 200]}"),
    g = w.add("group{orientation: 'row', alignChildren: ['left', 'center']}"),
    ok = g.add("button", undefined, 'Play all actions', { name: 'ok' }),
    cancel = g.add("button", undefined, 'Cancel', { name: 'cancel' }),
    idx = 1;

while (true) {
    (r = new ActionReference()).putIndex(s2t('actionSet'), idx++);
    try { l.add('item', executeActionGet(r).getString(s2t('name'))) } catch (e) { break; }
}
l.selection = 0; ok.enabled = l.items.length;
l.onClick = function () { ok.enabled = this.selection ? true : false };
ok.onClick = function () { l.onDoubleClick() }
l.onDoubleClick = function () {
    if (idx = this.selection.index + 1) {
        w.close();
        (r = new ActionReference()).putIndex(s2t('actionSet'), idx);
        var len = executeActionGet(r).getInteger(s2t('numberOfChildren'));
        for (var i = 1; i <= len; i++) {
            (r = new ActionReference()).putIndex(s2t('action'), i);
            r.putIndex(s2t('actionSet'), idx);
            (d = new ActionDescriptor()).putReference(s2t('target'), r);
            try { executeAction(s2t('play'), d) } catch (e) { }
        }
    }
}
w.show();

 

SteveBeeAuthor
Participating Frequently
March 1, 2021

jazz-y

Thanks - I hope the following will answer your question

 

Basically I'd like to place the script within any SET. Really it is to overcome the time consuming creating of a 'Run All Actions' step such as -         

                                  Play Action "Blue Tint" of BW Base

                                  Play Action "High Contrast" of BW Base

                                  Play Action "Matte" of BW Base

                                  Play Action   ...........  etc etc etc

 

Currently each of  those steps creates a 'Snpashot', then following all the "Play Actions........" I have a script which saves the Snapshots to JPG, and a further one to create Contact Sheets fron the JPGs. Those 2 scripts I keep seperate as quite often just browsing the JPGs is sufficient and no Contact Sheet is required.

Legend
March 1, 2021

Do you need a script that can be written as an action that, when activated, will launch all actions within the same set?

JJMack
Community Expert
Community Expert
March 1, 2021

That should be easy, Let say you have an action set with five actions in it: Action 1, Action 2, Action 3, Action 4 and, Action  5.  Create  action 6 that has five steps: Play Action 1, Play Action 2,  Play Action 3, Play Action 4 and,  Play Action  5.  Use action 6. 

 

If you want to  save a file for each action that would not be effected by the other actions, use Imaged Processor Pro  It can save up to 10 Image files for you document and user a different action processing your document per run.  Image Processor Pro is a Plug-in Script the you cans  record in an action.  So you could record an action that uses Image processor Pro several times and save up to 10 output file for in each run of its useage 

JJMack
Bojan Živković11378569
Community Expert
Community Expert
March 1, 2021

Does not work for OP:

"I am looking to create a generic script so I want to avoid an Action
running lots of other Actions as I'll have to create one for each group of
Actions."

Stephen Marsh
Community Expert
Community Expert
February 28, 2021

Can I presume that each play of the action works against a "clean" initial image and that one action does not run on the result of the previous action?

 

Will you be saving each action run version to a new file, or will you use a history snapshot for each action run and then manually save out various history snapshots to new files based on your evaluations?

 

Can you explain the full workflow with an overview of key steps? A simple step by step, bullet point overview is probably best to start.

 

Depending on your answers, an action, action+script or stand alone script may be the way to go.

SteveBeeAuthor
Participating Frequently
March 1, 2021
Can't access the site this morning so I hope this email gets through.

To your questions:

Clean image - Yes
History Snapshot

I am looking to create a generic script so I want to avoid an Action
running lots of other Actions as I'll have to create one for each group of
Actions.

Process - load image, run new script against an Action Set comprising 'N'
Actions, create Snapshot of resulting effect, Output Snapshots to File &
Contact Sheets . I already have written scripts for the Filing and Contact
Sheets.
JJMack
Community Expert
Community Expert
March 1, 2021

A Script can get a list of all actions set in you actions palette and the actions in each of the actions sets.  You could create a Script the would have a Pull Down to select an action set and to doe all the actions in the set. The script should have this in a Try Catch for and action can cause other actions to fail by changing the current document in some way  or save and close the current document so there is nothing open in Photoshop.  It would not be a something you would want to do with all your Action sets.  You mad want to duplicate the current document before doing a an action so each actions is not interfering with the other actions processing.  It would not be a generic script for the script not know what each action will do or behave errors are bound to occur. Actions have dependencies and Actions change documents.

JJMack