• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Modifications and Variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Question about Satimage OSAX
  • Next by Date: osascript problems
  • Previous by thread: Re: Modifications and Variables
  • Next by thread: Re: Modifications and Variables
  • Index(es):
    • Date
    • Thread