Re: How do I set script property in another script?
Re: How do I set script property in another script?
- Subject: Re: How do I set script property in another script?
- From: "Marc K. Myers" <email@hidden>
- Date: Fri, 03 Aug 2001 02:45:56 -0400
- Organization: [very little]
>
Date: Thu, 02 Aug 2001 18:12:14 -0400
>
From: "John Jones" <email@hidden>
>
To: <email@hidden>
>
Subject: How do I set script property in another script?
>
>
Hello all,
>
>
This has me stumped and none of the references I can find
>
has cleared it up. I've got "Script A" that is saved as an
>
application with a property:
>
>
property myNumber : "5"
>
>
"Script B" loads "Script A" into a variable and can get the
>
propety just fine:
>
>
load script "Floyd:Desktop Folder:test app"
>
set MyObject to result
>
get myNumber of MyObject
>
>
But when I try to set the property to a new value either
>
by...
>
>
set myNumber of MyObject to 20
>
>
or by
>
>
tell MyObject
>
set myNumber to 20
>
end tell
>
>
It sets the property in the MyObject script object, and not
>
in the original. (I at least understand that this is a copy
>
of the original!) So how can I actually set the value in the
>
original?
After you "load script" and modify the value of the property, you need
to "store script" the script object back into its original file:
store script myObject in "Floyd:Desktop Folder:test app" with replacing
store script: Store a script object into a file
store script script -- the script object to store
in file specification -- the file to store the script object in
[replacing ask/yes/no] -- control display of Save As dialog
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[8/3/01 2:45:15 AM]