Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pause execution of applescript for some time?

I have a small applescript in Automator:

do shell script "osascript ~/Focus-On.scpt"
delay 60
do shell script "osascript ~/Focus-Off.scpt"

Basically, i want to execute the first shell script, then, after a minute, the second one.

But Automator executes both without any delay. How to fix it?

like image 837
Eugene Avatar asked Dec 02 '25 18:12

Eugene


1 Answers

Try the load script way, this works on my machine:

set homeFolder to path to home folder as text
set scriptOn to load script alias (homeFolder & "Focus-On.scpt")
run scriptOn
delay 60.0
set scriptOff to load script alias (homeFolder & "Focus-Off.scpt")
run scriptOff
like image 174
vadian Avatar answered Dec 06 '25 07:12

vadian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!