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: "S. J. Cunningham" <email@hidden>
- Date: Wed, 11 May 2011 15:40:01 -0400
Just a clarification: all the "try's" and "display dialogs" were to help me try to figure out what is going on. My understanding is that I should see nothing after executing "continue quit". The fact that I do is the problem.
That is to say the simple script:
> on run {}
> quit
> display dialog "Whoops! Statement following quit in run handler"
> end run
>
> on quit {}
> continue quit
> end quit
Should never display the "Whoops" message and yet it does when compiled as an application. Thus, if I change the run handler to be an infinite loop, I can't quit the application from the application's menu.
On May 11, 2011, at 11:58 AM, S. J. Cunningham wrote:
> OS X 10.6.7. I want to run a script as an application but I can't seem to get the quit handler to quit. Seems to me it used to work this way but maybe my memory is faulty. Or maybe Snow Leopard changed something. Anyway, here is the sample script I am running. I get the same behavior with an implicit run handler. Help appreciated.
>
> Thanks.
>
> (*
> Quit Handler Example Case 1: Explicit run handler
>
> - Works as expected when run from Script Menu as either
> Compiled Data Fork or Compiled Bundle
> - Continue quit ignored when run as an Application Bundle
> either from Finder or Script Menu.
> *)
>
> on run {}
> display dialog "Quit Handler Example Case 1: explicit run handler"
> display dialog "Calling quit handler"
> quit
> display dialog "Whoops! Statement following quit in run handler"
> end run
>
> on quit {}
> display dialog "quit handler entered"
> try
> set dialogAnswer to display dialog ¬
> "Continue quit?" buttons {"Yes", "No", "Cancel"} ¬
> default button "Yes"
> if button returned of dialogAnswer is "Yes" then
> display dialog "continuing quit"
> continue quit
> display dialog "Statement following continue quit"
> else
> -- your code for No goes here
> end if
> on error number -128 -- userCanceledErr
> -- your code for Cancel goes here
> end try
> display dialog "Exiting quit handler"
> end quit
>
>
>
> _______________________________________________
> 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
_______________________________________________
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