Running a looping action through a script

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Kukurykus, Tom, xbytor

grishka89
Posts: 6
Joined: Sat Jun 05, 2021 12:27 am

Running a looping action through a script

Post by grishka89 »

Good day!
I really need the help of experts.

Help write a script that would run the action cyclically (repeating until it is manually stopped through the "Esc" button). I found something, but when I stop the action, the error pops up:

var repeat = true;
while (repeat) {
app.doAction("ActionName","ActionGroup.ATN")
}


Can anyone know how to do this without causing an error?

And yet ... in the action settings there is a "playback option" and there you can select a minimum pause of 1 second, is there a way to reduce the pause time to 0.2 seconds?

THANK YOU SO MUCH!!!!!!

User avatar
Kukurykus
Posts: 377
Joined: Mon Jul 25, 2016 12:36 pm

Re: Running a looping action through a script

Post by Kukurykus »

Code: Select all

try{while(true) {doAction('actionName','actionSetName'), $.sleep(200)}}catch(err){}

grishka89
Posts: 6
Joined: Sat Jun 05, 2021 12:27 am

Re: Running a looping action through a script

Post by grishka89 »

Kukurykus wrote:
Sat Jun 05, 2021 8:48 am

Code: Select all

try{while(true) {doAction('actionName','actionSetName'), $.sleep(200)}}catch(err){}
Yes! That's what I need!!! Thank you very much!! :D :D

I just have one question. Is it possible to use the code to reduce the time of the "Playback Options" and to pause every 0.2 seconds?

User avatar
Kukurykus
Posts: 377
Joined: Mon Jul 25, 2016 12:36 pm

Re: Running a looping action through a script

Post by Kukurykus »

No, so keep 'Accelerated' in 'Playback Options', while the delayes control by $.sleep()

grishka89
Posts: 6
Joined: Sat Jun 05, 2021 12:27 am

Re: Running a looping action through a script

Post by grishka89 »

Unfortunately, on the CC + version in the "Accelerator" mode, I cannot draw on the canvas, in parallel. I have to switch to Step by Step, but it's too slow.
Is it possible to somehow artificially create small pauses in the action?

Here's a video example of what I'm talking about - https://disk.yandex.ru/i/KlgDBAgnlmKh3g

Thank you! :D

User avatar
Kukurykus
Posts: 377
Joined: Mon Jul 25, 2016 12:36 pm

Re: Running a looping action through a script

Post by Kukurykus »

I solved this problem by workaround, but as it took much of my free time I can't share it for free.
If you are interested to pay for the script, leave in private message to me your E-Mail address :)

grishka89
Posts: 6
Joined: Sat Jun 05, 2021 12:27 am

Re: Running a looping action through a script

Post by grishka89 »

OK! I have sent you a private message.

User avatar
Kukurykus
Posts: 377
Joined: Mon Jul 25, 2016 12:36 pm

Re: Running a looping action through a script

Post by Kukurykus »

Unfortunately that happens second time this week I can't recieve private messages, as they must be for some reason approved by Administrator :/

This is what I'm getting trying to access your message: "You are not authorised to read private messages that are on hold."

Let's see if you can recieve the message I just sent to you with my E-Mail address.

Admin doesn't check pm's, so I can't solve many other forum problems as well.

grishka89
Posts: 6
Joined: Sat Jun 05, 2021 12:27 am

Re: Running a looping action through a script

Post by grishka89 »

Yes, I got a private message from you! :-)

User avatar
Kukurykus
Posts: 377
Joined: Mon Jul 25, 2016 12:36 pm

Re: Running a looping action through a script

Post by Kukurykus »

Nice to hear. I recieved E-Mail message from you, and sent back the answer.