Re: Modifications and Variables
Re: Modifications and Variables
- Subject: Re: Modifications and Variables
- From: Kai Edwards <email@hidden>
- Date: Fri, 03 Jan 2003 22:17:39 +0000
on Thu, 02 Jan 2003 21:09:56 -0800, Paul Berkowitz <email@hidden>
wrote:
>
Nevertheless, even after removing all properties and globals, the script was
>
showing a new modification date every time it ran, even when run-only. By
>
explicitly declaring every top-level variable (every single variable in the
>
run handler) as local, I succeeded in avoiding any modifications to the
>
script file.
Sorry Paul, I don't have first-hand experience of scripts run by a user with
execute but not write privileges - although I sometimes use an alternative
method to avoid automatic saves in a script. By moving the entire contents
of the run handler into another subroutine, all variables are removed from
the top level - and therefore not saved. For example:
---------
on doRun()
set x to 2
set y to 3
set z to x * y
-- etc...
end doRun
doRun()
---------
While there may be situations in which declaring local variables is
preferable, I find the above generally easier than keeping track of all the
variables that may be introduced into the main handler.
Sometimes, I may even manage something slightly more ambitious than the
example given... ;-)
--
Kai
_______________________________________________
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.