Re: exit this repeat loop
Re: exit this repeat loop
- Subject: Re: exit this repeat loop
- From: Robert Poland <email@hidden>
- Date: Mon, 12 Sep 2005 18:06:09 -0600
On Mon, 12 Sep 2005 09:24:41 -0600, Robert Poland <email@hidden> said:
Hi,
Is there a more elegant way to exit this repeat loop? Less than two lines?
Looking for a way to exit a long "System Events" repeat loop in case
of a problem.
repeat with index from 1 to the 10
set optionDown to testOption() -- line 1
if optionDown then return -- line 2
beep
delay 1
end repeat
on testOption()
if (keys pressed) contains "option" then
beep 2
set optionDown to true
return optionDown
else
set optionDown to false
end if
end testOption
I am very fond of throwing (and handling) an error as a way of jumping out
to any desired level. I regard this as elegant. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
Matt,
The test scripts seem to work fine but when I plug them into the
"final" script it fails. The lines
( tell application "Cuisine Script"
if testOption() then return
end tell)
are in a tell application "System Events". Does this make a difference?
I needed the ( tell application "Cuisine Script") to get it to compile.
Tia,
--
Bob Poland - Fort Collins, CO
http://www.ibrb.org/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden