Re: Quit Handler... What Am I Missing Here?
Re: Quit Handler... What Am I Missing Here?
- Subject: Re: Quit Handler... What Am I Missing Here?
- From: Axel Luttgens <email@hidden>
- Date: Thu, 12 May 2011 15:01:48 +0200
Le 12 mai 2011 à 14:06, S. J. Cunningham a écrit :
> Forgive the top post, but I am apparently still not asking my question clearly. Let me try again :-)
>
> I have a script compiled as an application which runs in an infinite loop, checking a website for changes every so often (Woot during a Woot-Off, if you must know). Like a total noob, I assumed that if I selected "Quit" from the running script's application menu, it would execute the quit handler and, well, quit. It doesn't. The only way I can quit the application is to Force Quit it and that leaves files open that the quit handler was supposed to clean up. This seems like a bug to me.
Right, the quit handler will be executed, but your script has still a lot to achieve, because of the infinite loop.
That is, the script will resume at the point it was in the loop and the application won't quit.
You could consider something like this:
MainLoop()
on MainLoop()
global gotQuit
set gotQuit to false
repeat while not gotQuit
-- here comes the loop's useful stuff
end repeat
end MainLoop
on quit
global gotQuit
-- perform cleaning tasks here
set gotQuit to true
continue quit -- needed for a stay open, harmless otherwise
end quit
HTH,
Axel
_______________________________________________
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