Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Trying to run an action on loop

New Here ,
Mar 09, 2020 Mar 09, 2020

Copy link to clipboard

Copied

Hi there, I have a large amount of images (~7000) and I'd like to stitch 4 of them together in a quadrant and save it as a file.

Currently I import about 250 into separate layers and I made an action that aligns them to each corner to complete the quadrant, but I have to continually click the Play button to process all the images.

Is there a way to repeat the action in some kind of loop? I can't use automate>batch because all the files are in the layers and are deleted as they are stitched.

I've tried to use a script to play another action which has a script that plays the initial action but then I get an error when it starts the 2nd Action.

"Could not complete the command because Photoshop was unable to find the Javascript file"

These are the 2 separate scripts:

app.doAction("Action2","Set2.ATN")

app.doAction("Action","Set.ATN")

Please let me know if there's an easier way that I'm not seeing

Thanks for your time!

TOPICS
Actions and scripting

Views

1.8K

Likes

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

Adobe Community Professional , Mar 09, 2020 Mar 09, 2020
Unclear explain. Do you need to run a certain Action 250 times? Create such a script and run it. for (var i = 0; i < 250; i++) app.doAction("Action 2","Set 2"); Type the name of the Action and Set Name very carefully. Just like in the action panel, without any ".ATN", taking into account spaces and case.  

Likes

Translate

Translate
Adobe Community Professional ,
Mar 09, 2020 Mar 09, 2020

Copy link to clipboard

Copied

Unclear explain. Do you need to run a certain Action 250 times?

Create such a script and run it.
for (var i = 0; i < 250; i++) app.doAction("Action 2","Set 2");

Type the name of the Action and Set Name very carefully.
Just like in the action panel, without any ".ATN", taking into account spaces and case.
 

Likes

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
New Here ,
Mar 09, 2020 Mar 09, 2020

Copy link to clipboard

Copied

Thank you!

This solves my problem! 

Likes

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
Explorer ,
Nov 13, 2020 Nov 13, 2020

Copy link to clipboard

Copied

Were you able to create a script to do this?  If so, can you please share it as I have no experience in how to create them.  I used to use this Iterate Actions extension to run loops: https://vimeo.com/8588910 but it no longer works in newer versions of PS.

 

Thanks

If you're interested in automatically running any Photoshop CS4 Action x-number of times, watch the video and download the Photoshop Plug-in available on my website. Search for PhotoshopCode: Loop Photoshop Actions at http://www.drwoohoo.com/labs.html and click on the Download Plug-in button.

Likes

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
Adobe Community Professional ,
Nov 13, 2020 Nov 13, 2020

Copy link to clipboard

Copied

Just follow r-bin's instructions for the single line of code posted back on the 10th of March 2020.

 

If you don't know how to copy/paste/save the code, see below:

 

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

 

Likes

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
Explorer ,
Nov 24, 2020 Nov 24, 2020

Copy link to clipboard

Copied

Thank you very much for the guide.  I saved the .txt file w/ the above code as "Action Loop.jsx" per the instructions, put it in the PS Scripts folder, but when I try to run it from the Scripts menu in Adobe Photoshop CC 2019 it gives me these 2 errors:

 

1) The command “Play” is not currently available.

2) Error 8007: User cancelled the operation

Line: 1

->  

 

I then tried adding the name of the action (located in the Actions window) in place of Action 2, but it gave me the same error.  Am I supposed to specify the action name in the script or does it prompt you to select one after running it?  And what do I put for "Set 2"?

 

Thanks

Likes

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
Adobe Community Professional ,
Nov 24, 2020 Nov 24, 2020

Copy link to clipboard

Copied

Here is an example image and code:

 

for (var i = 0; i < 250; i++) app.doAction("Molten Lead","Default Actions");

 

atn.png 

 

The "set" is the "folder" or "Default Actions" in the example above.

Likes

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
Explorer ,
Nov 24, 2020 Nov 24, 2020

Copy link to clipboard

Copied

Oh, that set – I forgot the folders were called sets.  Thanks for clarifying.  It works now!  No errors 🙂

 

What’s the best way to manually stop the script if needed?  Normally, the escape key or command+period do the trick, but sometimes the script keeps running anyway.  I assume these are the only 2 ways to abort other than force quitting the app.

 

Also, do you know if there’s a way to prevent the script loop from maxing out the CPU in Activity Monitor?

 

On another note, is it possible to edit your posts on this forum?  The “More” menu is not opening for me and I tried on 2 different browsers.

 

Thanks

Likes

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 ,
Nov 16, 2021 Nov 16, 2021

Copy link to clipboard

Copied

Here is a script, put this in a file RunActionX-Times.jsx(change the extension from .txt to .jsx) and copy to your Adobe Photoshop>Presets>Scripts folder on windows.

In Photoshop, your new script should appear under File>scripts. Just type in the number of times you want an action to run and VIOLA! Works like a charm!

 

Credit to jcombs

Link to original discussion

https://www.ozzu.com/questions/455621/photoshop-play-an-action-repeatedly#post-607170

 

Likes

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
Adobe Community Professional ,
Nov 17, 2021 Nov 17, 2021

Copy link to clipboard

Copied

Moderator please assaign 'Actions and scripting' label to this thread.

Likes

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
Adobe Community Professional ,
Nov 17, 2021 Nov 17, 2021

Copy link to clipboard

Copied

это сделано

Likes

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
Adobe Community Professional ,
Nov 17, 2021 Nov 17, 2021

Copy link to clipboard

Copied

LATEST

Polish would be more appropriate 😛

Likes

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