Re:Changing properties in an applet from another script
Re:Changing properties in an applet from another script
- Subject: Re:Changing properties in an applet from another script
- From: email@hidden
- Date: Fri, 22 Mar 2002 11:06:30 EST
In a message dated 3/21/2002 David.Wadson wrote:
<<Is it possible to change the values in a script applet from another
script/applet? I'm working on a number of scripts and am trying to figure
out the best way to save properties and preferences for how it will work. I
want the scripts to be configurable by the end user without having to edit
raw code. Simple enough to do in the run handler - just throw in some
routines for choosing folders, etc. and have those saved in a property. But
in order to simplify the final application, and make it less likely that the
wrong user would accidentally change the settings, I curious as to whether a
separate setup applet could be written that would edit the settings in the
main applet. >>
I've done something very similar to this, the main difference being that I'm
storing the user preferences in a separate script file. Here's a stripped
down example:
--script 1:
set firstList to {1, 2, 3}
set secondList to {4, 5, 6}
script storedLists
firstList
secondList
end script
store script storedLists in file ((path to system folder as string) &
"Scripts:MyLists") replacing yes
--script 2:
set myLists to load script file ((path to system folder as string) &
"Scripts:MyLists")
choose from list (firstList of myLists)
choose from list (myLists's secondList)
As you change the contents of the list in script 1, the displayed lists in
script 2 also will change. In the real world, your pref-setting script would
have some kind of interface to find out what the user's preferences are, and
script 2 would do something useful with those prefs. Script 2, btw, should
have some kind of default settings in case the "MyLists" file has been
deleted.
I'm pretty confident that you could eliminate the middleman by loading your
main applet into a prefs-setting applet, changing its properties and
re-storing it. I went the other direction because my main applet is pretty
big and I wanted to be able to change it without wiping out the user's
preferences.
Hope this helps,
Robert Kyle
Star Tribune
Minneapolis
_______________________________________________
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.