Re: Why Doesn't This Script.app Quit?
Re: Why Doesn't This Script.app Quit?
- Subject: Re: Why Doesn't This Script.app Quit?
- From: Nigel Garvey <email@hidden>
- Date: Sun, 17 Jan 2016 10:56:42 +0000
Shane Stanley wrote on Sun, 17 Jan 2016 13:00:18 +1100:
>On 17 Jan 2016, at 07:00, S. J. Cunningham <email@hidden> wrote:
>
>>I did it this way to make it a little more transparent::
>>
>>on run
>> quit
>> display dialog "Hah Hah Hah! You can't kill me!"
>>end run
>>
>>on quit
>> error number -128
>>end quit
>>
>>I also wrote a routine to get the Process ID and kill it via "do shell
>>script", but this is more direct.
>
>Maybe I missed something, but why aren't you using "continue quit" in
>the quit handler?
I don't think Steve fully understood the advice he received from Ed and
myself. (My own post wasn't very well phrased.)
1. 'quit' is a command for telling an application to quit.
2. 'error number -128' is a command for stopping the execution of a script.
3. On a Snow Leopard system, when a script applet's told to quit in the middle of a script, it'll complete what it's doing first — that is, it'll execute the remainder of the script. If there's no convenient way to branch directly to the end, the execution can stopped immediately with 'error number -128'.
4. With an ordinary applet, that should be enough, as in Ed's post. The applet will then quit anyway because it's no longer running the script. There's no need to use 'quit' at all.
5. My earlier suggestion was more suited to quitting stay-open applets, which only quit when explicitly told to do so. Here you might use 'quit' followed by 'error number -128'. (However, the applet will only quit at the end of the next idle interval. So if the 'quit' command's in the 'idle' handler itself, it may be better to follow it with 'return 1' instead of the error to minimise the delay before the quit occurs.)
6. Contrary to Steve's assertion in quote above, It's more transparent to write 'error number -128' when that's what's meant than to disguise it as a 'quit' command.
NG
_______________________________________________
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