Re: applescript-users digest, Vol 3 #887 - 11 msgs
Re: applescript-users digest, Vol 3 #887 - 11 msgs
- Subject: Re: applescript-users digest, Vol 3 #887 - 11 msgs
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 23 Sep 2002 14:50:47 -0400
Date: Mon, 23 Sep 2002 10:15:59 -0500
From: "ken " <email@hidden>
Reply-To: <email@hidden>
To: <email@hidden>
Subject: Script Object Property Persistence
I've found many topics on this subject in the archives, but I have to
admit I don't really understand how to apply the various solutions
to my situation.
What I have is a script called "CatalogAssets" which has the
following in it:
-- *** begin CatalogAssets script sample
property scratchDisk:""
catalogAssestsMain()
-- thisDiskName is a string the user has already defined
set scratchDisk to thisDiskName
end catalogAssestsMain
-- *** end CatalogAssets script sample
Naturally, there is much more to it than this, but this is all that's
relevant. Now, this script is saved on disk and called from another
script in this manner:
set catalogAssets to load script alias (**path to the saved script
object**)
catalogAssestsMain() of catalogAssets
This will correctly load the script and run the handler, but the
property scratchDisk resets to "" every time I run the script. What do
I have to do to get the property scratchDisk to hold it's value
between runs?
Every time you "load script" you're pulling in a fresh copy of the
script from its file. This file never gets updated. To retain the
property info you'll have to "store script" back to the file before
exiting the calling script. An easier way is to make your script
object a property of the calling script.
property catalogAssets:load script alias (**path to the saved script
object**)
It'll load the script object at compile time only. The disadvantage of
this technique is that you'll have to recompile the calling script if
you modify the called script. If more than one script calls the saved
script object this is the only way to have different scratchDisk for
each calling script, unless you make it a property of the calling
script directly.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[9/23/02 2:44:33 PM]
_______________________________________________
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.