Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Other than inter-dependent Actions I write others in such a way as each starts with a 'clean' image and all adjustment layers are uniquely named. Basic scripting I'm quite happy with but I can't fathom how to look at an Action Set and play all Actions (no need for a drop down) within it - the script would naturally only be used when playing say 10 Actions each creating a different B/W interpretation of an image.
Copy link to clipboard
Copied
I'm sure if you search the web you will find Photoshop scripts that process Photoshop items like the Action palette. You might want look at things like Xtools, scripts like RunAction. IMO playing all action in a action set on a document is not likely something users would want to do. Action sets are not created with a process like that in mind.
Even you wrote "I write others in such a way as each starts with a 'clean' image and all adjustment layers are uniquely named." So your Play all Action Script would need to do some special processing. It would need to create a duplicate for the document to be able to refresh the document after doing an action. Or Do the action on a duplicated document. Then save an output image file like a PSD files indicating action x from action set Name use used to generate the PSD. Repeating this process till all actions are done. The Do action part need to be in a try catch so you can catch actions that fail and skip saving the psd.
"I write others in such a way as each starts with a 'clean' image and all adjustment layers are uniquely named."
Action can not generate a unique layer name they can not use logic to do that they can create layers and name Layers and hope the document does not have a layers with a duplicate layer name. If you run the action twice most likely it will create a layer with a duplicated layer name. It best that actions do not depend on layers names. Actions that process layer by relative position are better then action that process layers by name, they just let Photoshop generate names. However action can not process layer that have their visibility turn off relatively. The Action managers relative layer addressing work on visible layer. Layer with visibility off are skipped over when action use relative layer addressing. The selection of a layer with its visibility off is difficult without selecting it by name.
Copy link to clipboard
Copied
I'm sorry but we do seem at odds with my use of English - when I say ""I write others in such a way as each starts with a 'clean' image and all adjustment layers are uniquely named." I mean I write the Action and give each Adjustment Layer a unique name.
WRT - "IMO playing all action in a action set on a document is not likely something users would want to do. " - perhaps not, but that is what I want to do.
WRT - "I'm sure if you search the web you will find Photoshop scripts that process Photoshop items like the Action palette." - I've been unable to find any, hence I thought I'd ask here but I'll continue to search alternative sources and provide an update if successful.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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."
Copy link to clipboard
Copied
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();
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Do you need a script that can be written as an action that, when activated, will launch all actions within the same set?
Copy link to clipboard
Copied
I was considering to place the script within an Action much as I do at the moment eg: I have a BW conversion SET comprising 20 conversion Actions, the logic would be :
Run ALL BW Bases (Action)
o STOP - gives user instructions (existing)
o Flatten Image (existing)
o Existing Script - clean out any existing Snapshots (existing)
o NEW SCRIPT - run all BW Actions
o Save new Snapshots to JPG (existing)
o Create Contact Sheets (existing)
Then individual Actions
o Blue Tint
o High Contrast
o Matte
o etc etc etc
Copy link to clipboard
Copied
where are these actions located? in another set?
It may be easier to use screenshots to explain your task.
Copy link to clipboard
Copied
No I think I'll leave it. But thanks anyway.
Copy link to clipboard
Copied
There's only one problem - it is difficult to understand from which set script was launched, so the playback source is determined indirectly: by the name and index of the parent operation (action). If you are using several sets at the same time, take this point into account (the action with the script must either be named differently, or be located at different positions within the set)
#target photoshop
/*
<javascriptresource>
<name>Play all actions</name>
<eventid>957c6aae-60f7-49d7-817a-f93d6c2378ef</eventid>
<terminology><![CDATA[<< /Version 1
/Events <<
/957c6aae-60f7-49d7-817a-f93d6c2378ef [(Play all actions) <<
>>]
>>
>> ]]></terminology>
</javascriptresource>
*/
var s2t = stringIDToTypeID,
isCancelled = false, u;
if (!playbackParameters.count) {
(d = new ActionDescriptor()).putString(s2t('target'), 'play from next action');
if (selectMode(d) == 1) { playbackParameters = d } else { isCancelled = true }
} else {
d = playbackParameters;
if (playbackDisplayDialogs == DialogModes.ALL) {
if (selectMode(d) == 1) { playbackParameters = d }
} else if (playbackDisplayDialogs != DialogModes.ALL) {
$.setenv('stop', (d.getString(s2t('target')) == 'stop here'))
set = getActionIdx()
for (var i = set.atnIdx; i <= set.len; i++) {
if ($.getenv('stop') == 'true') { break; }
(r = new ActionReference()).putIndex(s2t('action'), i);
r.putIndex(s2t('actionSet'), set.setIdx);
(d = new ActionDescriptor()).putReference(s2t('target'), r);
try { executeAction(s2t('play'), d) } catch (e) { }
}
}
}
isCancelled ? 'cancel' : u
function selectMode(d) {
w = new Window("dialog {text: 'Play all actions', orientation: 'column', alignChildren: ['left','top']}"),
p = w.add("radiobutton{text: 'play from next action'}"),
s = w.add("radiobutton{text: 'stop here'}"),
g = w.add("group{orientation: 'row', alignChildren: ['left', 'center']}"),
ok = g.add("button", u, 'Save settings', { name: 'ok' }),
cancel = g.add("button", u, 'Cancel', { name: 'cancel' });
p.value = (d.getString(s2t('target')) == p.text)
s.value = (d.getString(s2t('target')) == s.text)
p.onClick = function () { d.putString(s2t('target'), this.text) }
s.onClick = function () { d.putString(s2t('target'), this.text) }
return w.show();
}
function getActionIdx() {
(r = new ActionReference()).putEnumerated(s2t('action'), s2t('ordinal'), s2t('targetEnum'));
command = executeActionGet(r);
return getSetIdx(command.getInteger(s2t('parentIndex')), command.getString(s2t('parentName')))
function getSetIdx(atnIdx, atnName) {
var setIdx = 1
while (true) {
(r = new ActionReference()).putIndex(s2t('actionSet'), setIdx)
try { d = executeActionGet(r) } catch (e) { break; }
var numberOfChildren = d.hasKey(s2t('numberOfChildren')) ? d.getInteger(s2t('numberOfChildren')) : 0
if (numberOfChildren > 0 && atnIdx <= numberOfChildren) {
(r = new ActionReference()).putProperty(s2t('property'), s2t('name'));
r.putIndex(s2t('action'), atnIdx);
r.putIndex(s2t('actionSet'), setIdx);
if (executeActionGet(r).getString(s2t('name')) == atnName) {
return { setIdx: setIdx, len: numberOfChildren, atnIdx: atnIdx + 1 }
}
}
setIdx++
}
return null
}
}
Copy link to clipboard
Copied
if (name.split('Photoshop').length - 1 && !$.getenv('not')) $.setenv('not', 1), notifiers.add('Ply ', File($.fileName))
else if(arguments) alert(arguments[0].getReference(stringIDToTypeID('null')).getContainer().getContainer().getName())
You can implement above code other way, but for example if you save it in:
\c\Program Files (x86)\Common Files\Adobe\Startup Scripts CC\Adobe Photoshop
Then relaunch Photoshop you'll get name of actionSet that's grandparent for played command.
To get the same name when playing not command, but operation, remove one .getContainer()
Copy link to clipboard
Copied
The problem is that the notification can only be received after the action is ended, which complicates the script logic somewhat. Since the author could not explain what exactly he needed, I decided not to bother