• 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: Quit Handler... What Am I Missing Here?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quit Handler... What Am I Missing Here?


  • Subject: Re: Quit Handler... What Am I Missing Here?
  • From: Luther Fuller <email@hidden>
  • Date: Wed, 11 May 2011 19:08:34 -0500

On May 11, 2011, at 6:36 PM, S. J. Cunningham wrote:

> -- Simple quit test
>
> on run {}
> 	repeat while (true)
> 	end repeat
> 	display dialog "Whoops! Statement following quit in run handler"
> end run
>
> on quit {}
> 	continue quit
> end quit

'quit' does not do that! This script will run forever. (Fortunately there is 'Force Quit')

You must write some condition in the loop that will exit the loop ...

on run
	repeat
		delay 1
		if <some_contition> then exit repeat -- or return
		--
		-- do stuff here
		--
	end repeat
end run

The 'delay 1' is there for two good reasons:
1. Not putting it there wastes cpu time ... your application becomes a cpu hog.
2. About 6 or 8 months ago, while doing some temperature tests, I found that a 'repeat' loop
    without a 'delay' will cause (perhaps dangerous) over-heating.

If you wish to "call" the 'quit' handler from the 'run' handler, simply use 'return'.

 _______________________________________________
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

References: 
 >Quit Handler... What Am I Missing Here? (From: "S. J. Cunningham" <email@hidden>)
 >Re: Quit Handler... What Am I Missing Here? (From: "S. J. Cunningham" <email@hidden>)
 >Re: Quit Handler... What Am I Missing Here? (From: Luther Fuller <email@hidden>)
 >Re: Quit Handler... What Am I Missing Here? (From: "S. J. Cunningham" <email@hidden>)

  • Prev by Date: Re: Quit Handler... What Am I Missing Here?
  • Next by Date: Re: Quit Handler... What Am I Missing Here?
  • Previous by thread: Re: Quit Handler... What Am I Missing Here?
  • Next by thread: Re: Quit Handler... What Am I Missing Here?
  • Index(es):
    • Date
    • Thread