• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: exit this repeat loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exit this repeat loop


  • Subject: Re: exit this repeat loop
  • From: Robert Poland <email@hidden>
  • Date: Mon, 12 Sep 2005 11:19:23 -0600

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

Tia,
--
Bob Poland - Fort Collins, CO

As usual I got several good answers. Results;

repeat with index from 1 to the 10
	if testOption() then return
	beep
	delay 1
end repeat

on testOption()
	(keys pressed) contains "option"
end testOption

Turns out I didn't ask the right question.

That repeat loop is inside another one, and this only quits the inside one. Is there a simple way to quit the script?
--
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
References: 
 >exit this repeat loop (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Server Space
  • Next by Date: Re: exit this repeat loop
  • Previous by thread: Re: exit this repeat loop
  • Next by thread: Re: exit this repeat loop
  • Index(es):
    • Date
    • Thread