Skip to main content
Participant
September 4, 2024
Answered

Repeat Action X times

  • September 4, 2024
  • 2 replies
  • 1009 views

Is a script still required to repeat/play an action X number of times (i.e. cmd+opt+T)? I want to do this 100 times.

 

Thanks,

Greg

Correct answer Stephen Marsh
quote

Is a script still required to repeat/play an action X number of times (i.e. cmd+opt+T)? I want to do this 100 times.

 

Thanks,

Greg


By @BirdforThought

 

Yes, a script is still required as there is no native feature for this.

 

Change the name of the action set and action in the code from the default action and set placeholder example.

 

#target photoshop

// Loop the input prompt until a number is entered
var origInput;
while (isNaN(origInput = prompt("Enter a whole number:", "3")));
// Convert decimal input to integer
var inputToInteger = parseInt(origInput);

function main() {
    for (i = 0; i < inputToInteger; i++) // Variable prompt N times
    {
        app.doAction("Molten Lead", "Default Actions.atn"); // Change the action and action set as required
    }
}
app.activeDocument.suspendHistory("Repeat action N times (history suspended)", "main()");

 

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

2 replies

Stephen Marsh
Community Expert
Community Expert
September 4, 2024
Participant
September 4, 2024

I got it and incidentally used the first script!!  The issue was my mac was hiding my file extension.. ha.

 

Thanks for your help. You saved me hours of work.  although I spent an hour on this issue.. haha

Stephen Marsh
Community Expert
Community Expert
September 4, 2024
quote

I got it and incidentally used the first script!!  The issue was my mac was hiding my file extension.. ha.

 

Thanks for your help. You saved me hours of work.  although I spent an hour on this issue.. haha


By @BirdforThought


You're welcome!

 

Hopefully the next time you need to use a script it will go faster for you now that you know what to look for.

 

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
September 4, 2024
quote

Is a script still required to repeat/play an action X number of times (i.e. cmd+opt+T)? I want to do this 100 times.

 

Thanks,

Greg


By @BirdforThought

 

Yes, a script is still required as there is no native feature for this.

 

Change the name of the action set and action in the code from the default action and set placeholder example.

 

#target photoshop

// Loop the input prompt until a number is entered
var origInput;
while (isNaN(origInput = prompt("Enter a whole number:", "3")));
// Convert decimal input to integer
var inputToInteger = parseInt(origInput);

function main() {
    for (i = 0; i < inputToInteger; i++) // Variable prompt N times
    {
        app.doAction("Molten Lead", "Default Actions.atn"); // Change the action and action set as required
    }
}
app.activeDocument.suspendHistory("Repeat action N times (history suspended)", "main()");

 

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

Inspiring
February 13, 2025

Hi there. Having an issue with this script: I need to run it 15 times, but after the 10th output, instead of making the 11th, 12th, 13th 14th and 15th file, it just overwrites the first 001 file for the last 5 files. Any ideas why this is happening? Thanks.

Stephen Marsh
Community Expert
Community Expert
February 13, 2025

@floydninja 

 

The script would just repeat the action, so it sounds action related.