• 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
How do I set script property in another script?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I set script property in another script?


  • Subject: How do I set script property in another script?
  • From: email@hidden
  • Date: Fri, 3 Aug 2001 00:17:36 -0400

On Thu, 02 Aug 2001 18:12:14 -0400, "John Jones" <email@hidden> asked,

> 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"
>
[...]
>
> 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?

You'll have to use "store script" to write the modified script back out.

You say you've saved Script A as an application. You probably need to either
save it as a compiled script, or you mean to be running Script A as an
application, and not "load script"-ing it. That is, you would address it as an
application,

tell application "Script A" to set its myNumber to 20

It's not that you can't "load script" the application, but I'm thinking you are
running Script A itself, as well as "load script"ing it. In that case, there
are two copies of the script, and they may overwrite each other's changes. Also
be aware that the original text value of the property will be restored if you
recompile the script. So if you want a script to provide persistent storage of
values, you probably should save it as "Run only" so it can't ever be
recompiled.

--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden


  • Prev by Date: Re: Settings backup script
  • Next by Date: Re: Script Editor 1.6 problems ...
  • Previous by thread: Re: How do I set script property in another script?
  • Next by thread: Re: How do I set script property in another script?
  • Index(es):
    • Date
    • Thread