Re: No more "delay" in AS-Yosemite?
Re: No more "delay" in AS-Yosemite?
- Subject: Re: No more "delay" in AS-Yosemite?
- From: Shane Stanley <email@hidden>
- Date: Thu, 13 Nov 2014 11:49:25 +1100
On 11 Nov 2014, at 7:41 pm, Maik Waschfeld <email@hidden> wrote:Since Yosemite, all my AppleScripts using „delay“, as in
stopped working.
Instead of waiting for 30 seconds, it executes the next step when I simply touch the trackpad.
The same AppleScripts work as expected in Mavericks.
So now I see what Maik was referring to -- the delay command is broken in Yosemite, at least in applets. Run this script as an applet:
set time1 to current date set progress total steps to 10 repeat with i from 1 to 10 set progress description to "Processing " & i & " of " & 10 delay 3 set progress completed steps to i end repeat display dialog ((current date) - time1) as text
If you just sit and watch it, it behaves as you'd expect. But as soon as you move your mouse, whoosh -- it finishes post-haste.
So it looks like either the shell or ASObjC is the way to go.
One thing I'd suggest, though, is not using something like:
do shell script "sleep 30"
or:
current application's NSThread's sleepForTimeInterval:30
But rather:
repeat 30 times do shell script "sleep 1" end repeat
or:
repeat 30 times current application's NSThread's sleepForTimeInterval:1 end repeat
That's because the delay command does some special stuff that avoids spinning cursors, and that doesn't happen with the other methods.
|
_______________________________________________
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