Re: script editor wants to save an unchanged script
Re: script editor wants to save an unchanged script
- Subject: Re: script editor wants to save an unchanged script
- From: Nigel Garvey <email@hidden>
- Date: Thu, 22 Nov 2001 01:19:51 +0000
Mr Tea wrote on Wed, 21 Nov 2001 21:25:13 +0000:
>
This from Donald S. Hall - dated 21/11/01 7.12 am:
>
>
> Can anyone tell why, after running the script below in the Script Editor,
>
I
>
> am always asked if I want to save the changes to the script even though I
>
> have not made any changes?
>
>
Its the variables. When you open the script they have a null value, when you
>
run it, they change to the values you set. Therefore the Script Editor
>
thinks that the script has changed - as indeed it has, in a metaphysical
>
sort of way.
>
>
That's my hypothesis, anyway, and it seems to be upheld by the following
>
example:
>
>
This script does not ask if you want to save it after running:
>
>
display dialog "At present, Mac OS X is a step back for most users."
>
>
...while this one does:
>
>
set theDialog to "At present, Mac OS X is a step back for most users."
>
display dialog theDialog
Specifically, it's the global variables and properties. They're global
here because they're at the top level of the script and, when they're
set, their values are stored in it. When running the script in Script
Editor, it's the manifestation within Script Editor that gets updated
rather than the file on disk. Setting only local variables doesn't
"change the script":
on main()
set theDialog to "With Mac OS 9, US English became "International"
end main
main()
Bill Briggs did some research for his AppleScript Primer column a while
ago which showed that the effect varies according to which script editor
software you're using.
NG