Re: delay doesn't work when applet is not frontmost
Re: delay doesn't work when applet is not frontmost
- Subject: Re: delay doesn't work when applet is not frontmost
- From: Shane Stanley <email@hidden>
- Date: Thu, 05 Mar 2015 11:23:08 +1100
On 5 Mar 2015, at 11:06 am, Stockly, Ed <email@hidden> wrote:
>
> If I save this script as an applet, the delay 20 command seems to be
> ignored as soon as the script is no longer frontmost.
>
> If you remove the finder activate command, the delay works, but if you
> bring another app to the front, it stops delaying and goes on with the
> script.
>
> Can anyone repeat see this? Is it new?
It's a Yosemite thing, and it's worse than that -- just moving the mouse is enough to end all delays. You don't generally notice it in editors because they usually run scripts on a background thread, and the problem only happens on the main thread. It was discussed here some time back.
A workaround is to add this to your scripts:
on delay delayTime
set theRepeat to delayTime * 10 div 1
repeat theRepeat times
do shell script "sleep 0.1"
end repeat
end delay
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden