Re: Still don't understand timeout
Re: Still don't understand timeout
- Subject: Re: Still don't understand timeout
- From: "Stockly, Ed" <email@hidden>
- Date: Fri, 19 Aug 2011 20:57:25 +0000
- Thread-topic: Still don't understand timeout
>>>If I understand right "with timeout" doesn't end and stop the block. Is there something that will do that?
Here's another way of looking at it: The timeout is only invoked if a single apple event takes more than the specified time to complete. In the script below the timeout would never be invoked because no apple event takes more than 2 seconds.
>> Seems to me that the following script should timeout and quit but it doesn't
>>
>> try
>> with timeout of 2 seconds
>> tell application "Finder"
>> set x to 1
>> repeat while x < 5
>> delay 1
>> set x to x + 1
>> end repeat
>> end tell
>> end timeout
>> on error
>> log "repeat error"
>> end try
>> beep
It sounds like you're looking for some kind of a timing routine:
----
set quitTime to (current date) + 5
try
with timeout of 2 seconds
set x to 1
repeat while x < 10
if (current date) > quitTime then error "Quit Time"
delay 1
set x to x + 1
end repeat
end timeout
on error errText
display dialog (x as text) & return & errText
end try
----
HTH,
ES
_______________________________________________
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