Re: Script application "bundles" that are read-only: error when quitting
Re: Script application "bundles" that are read-only: error when quitting
- Subject: Re: Script application "bundles" that are read-only: error when quitting
- From: Stephen Jonke <email@hidden>
- Date: Mon, 18 Jul 2005 09:51:47 -0400
Hmmm... but what I need *is* a global variable or property. The
values in question are shared by various subroutines within the
script. I am already using a plist file to store data I want to be
persistent (and to make it survive re-compiles of the script). I
tried putting properties within script objects, but those seem to
result in an attempt to save data to the script at quit anyway.
So I guess the real question is, is there way to have a property or
global variable that is not persistent and thus does not result in an
attempt to save the data to the script application itself?
Steve
On Jul 17, 2005, at 11:41 PM, Paul Berkowitz wrote:
On 7/17/05 7:23 PM, "Stephen Jonke" <email@hidden> wrote:
Is this a known bug? If a script application was saved as an
"Application bundle" and then the script is run with read-only
privileges, you get an error at quit saying that it can't save
changes to the script. Specifically:
-5000: Could not save changes to this script because you do not
have the necessary access privileges
If the script is saved instead as an "application" (not a bundle),
you don't get this error message, instead it just doesn't save
changes to properties at quit. That's the behavior I want. Is there
any way to work around this issue for application bundles? I want to
use a bundle so I can have a real icon, version information in Get
Info, etc, but now if a user without write privileges to the script
application bundle runs it, they get this error at quit.
Note that I tried putting "ignoring application responses" around a
"continue quit" statement in a quit handler, but this didn't work.
Nor did "try".
Are there any script properties that need to be saved between
script runs?
If so, consider making a preferences file and save them there
instead. It
could be a .plist file using 'do shell script "defaults write"', or
you can
just save them in a file using 'write' standard addition and read
them back.
Then go through your script, finding every variable you have set at
the top
level. Either declare them all as local at the top of the script,
or put the
entire top level into a subroutine you call in a single line, since in
subroutines all variables are local by default. Unlike properties,
globals
and top-level variables (which are actually a sort of global), local
variables are not saved when a script quits, so nothing is changed
and you
shouldn't get that error.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (Applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_________________________________________________________________
Stephen Jonke 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:
This email sent to email@hidden