Skip to main content
Participant
July 8, 2022
Answered

Automate - Batch - Action Question

  • July 8, 2022
  • 1 reply
  • 326 views

Would it be possible to run an action on selected open images not just all of the open images at the time ?

 

Ideally I would like to batch run this saved action on my open 'Untitled' images and not apply the action to the other original images that are open at the time.

 

Could you please let me know if this would be achievable ? And how best to do this.

 

Thanks for taking the time to read my post, I welcome your thoughts.

This topic has been closed for replies.
Correct answer Stephen Marsh

The following script will only run the Default Action set and Molten Lead action on files that have never been saved.

 

/*
https://community.adobe.com/t5/photoshop-ecosystem-discussions/automate-batch-action-question/td-p/13056955
*/

#target photoshop

for (var i = 0; i < app.documents.length; i++) {
    activeDocument = app.documents[i];
    try {
        app.activeDocument.path;
        // Do nothing for previously saved files
    } catch (e) {
        // Run action on unsaved files
        app.doAction("Molten Lead", "Default Actions");
    }
}

 

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

1 reply

c.pfaffenbichler
Community Expert
Community Expert
July 8, 2022

I expect this would take a Script, so a plain Batch would not suffice. 

Depending on the situation an Action with a Conditional in a Batch might suffice, though. 

Stephen Marsh
Community Expert
Community Expert
July 8, 2022

@c.pfaffenbichler wrote:

I expect this would take a Script, so a plain Batch would not suffice. 

 

That was my first thought, then I got stuck in infinite loops!

 


Depending on the situation an Action with a Conditional in a Batch might suffice, though. 


 

Good suggestion! The invert action in this example is only applied to unsaved files, so make sure that all open files have been saved, except for the Untitled-# ones!

 

 

I'd still be interested in seeing the scripted version!

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
July 8, 2022

The following script will only run the Default Action set and Molten Lead action on files that have never been saved.

 

/*
https://community.adobe.com/t5/photoshop-ecosystem-discussions/automate-batch-action-question/td-p/13056955
*/

#target photoshop

for (var i = 0; i < app.documents.length; i++) {
    activeDocument = app.documents[i];
    try {
        app.activeDocument.path;
        // Do nothing for previously saved files
    } catch (e) {
        // Run action on unsaved files
        app.doAction("Molten Lead", "Default Actions");
    }
}

 

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html