Re: Timed loop
Re: Timed loop
- Subject: Re: Timed loop
- From: Doug McNutt <email@hidden>
- Date: Thu, 22 Nov 2007 11:37:45 -0700
At 09:53 -0800 11/22/07, Ed Stockly wrote:
>>set jetzt to current date
>>set dann to jetzt + 10 * minutes
>>repeat until (current date) >= dann
>> delay 10 -- do your work here. I chose a delay because I have
>>nothing to do
>>end repeat
>
>That loop could be replaced with a single line:
>delay 600
>
>So, if there is nothing to do inside your loop, you don't need to loop at all.
>However, if there is work to be done within your loop then I'd try something like this:
>
>repeat 60 times
>--do some stuff
>delay 10
>end repeat
>
>I prefer not making multiple calls to OSAX when not needed, and getting the current date multiple times is not needed here.
I donno if it has changed - I'm stuck on Panther - but AppleScript's delay was a simple loop that doesn't release the computer to do other things.
do shell script "sleep 600"
involves some set up time but it will allow other activities full access to the machine during the delay. There is also an "at" shell command that might be useful. man at in Terminal.app. But have a look at the recent thread "Subject: Re: Applescript schedulers" for launchd considerations in Leopard.
--
--> From the U S of A, the only socialist country that refuses to admit it. <--
_______________________________________________
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