Skip to main content
Participant
March 9, 2020
Answered

Trying to run an action on loop

  • March 9, 2020
  • 3 replies
  • 6881 views

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!

This topic has been closed for replies.
Correct answer r-bin
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.
 

3 replies

Kukurykus
Legend
November 17, 2021

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

PECourtejoie
Community Expert
Community Expert
November 17, 2021
это сделано
Kukurykus
Legend
November 17, 2021

Polish would be more appropriate 😛

kirank51547421
Participant
November 17, 2021

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

 

r-binCorrect answer
Legend
March 9, 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.
 
Participant
March 9, 2020

Thank you!

This solves my problem! 

Stephen Marsh
Community Expert
Community Expert
November 25, 2020

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


Here is an example image and code:

 

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

 

 

 

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