Re: BUG: Store script Perversity - Bug found
Re: BUG: Store script Perversity - Bug found
- Subject: Re: BUG: Store script Perversity - Bug found
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 29 Dec 2002 14:30:23 -0800
On 12/29/02 12:09 PM, I wrote:
>
> This is irrelevant to the fact that a quit handler when quitting normally
>
> at the end of a run should not interfere with the script storing itself in
>
> its own shell and not in some other innocent file.
>
>
>
> It needs more than just storing another script object and a quit handler,
>
> however. That does not replicate on its own, nor when I load a third
>
> script nor when I use 24U Appearance osax as well. Nor when I add some
>
> useless fluff to make the script 120K length. There's some other thing
>
> which must be needed as well, and I don't know what it is yet.
>
I still haven't discovered that yet. But I've proved definitively that the
>
bug occurs at the very instant the the script finally quits, after leaving
>
the quit handler, not at the 'store script' step.
I found the missing component: the real bug, and can replicate 100% it in a
short script.
Tested in OS 10.2.3, AS 1.9.1 with System Events 2.0 beta and also in OS
10.2.2, AS 1.9.
My quit handler contained the line:
tell application "Finder" to set abOpen to (exists process "Address
Book")
That's what did it (changed the shell for the script from its own shell to
the file in which it previously stored another script object). Changing the
application from the Finder to System Events fixes the problem. Fortunately
my script requires OS 10.2.2 or higher, so I can use System Events rather
than the Finder. But it means that the Legacy Suite of the Finder has a
hole, in OS 10.2.3, AS 1.9.1 with System Events 2.0 beta and OS 10.2.2, AS
1.9 (so surely also in OS 10.2.3, AS 1.9.1, no betas.)
Here are the scripts: save them as applications called Script A and Script
B. You must run them as applications, not from Script Editor. I suggest that
you make another copy of script B before you run anything.
Script B:
-----------------------
--This is script B
property lastDate : date "Friday, January 1, 1904 12:00:00 AM"
display dialog "Script B still here." & return & return & (lastDate as
string)
------------------
Script A:
-----------------
--This is script A.
property lastDate : date "Friday, January 1, 1904 12:00:00 AM"
on run
display dialog "Script A here" & return & return & (lastDate as string)
set my lastDate to current date
set scriptBFile to choose file with prompt "Where is script B?"
set scriptB to load script scriptBFile
set scriptB's lastDate to current date
store script scriptB in scriptBFile replacing yes
display dialog "Just set scriptB's lastDate to " & (scriptB's lastDate
as string) & return & return & "Now run Script B."
end run
on quit
tell application "Finder" to set theBug to (exists process "Address
Book")
continue quit
end quit
-----------------------------------------------
Run Script B.
Run Script A.
Now run Script B.
Then open script A, change "Finder" to "System Events", save, close and run
it again using the untouched copy of Script B. Then run that copy.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.