• 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
script object properties: seeking confirmation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

script object properties: seeking confirmation


  • Subject: script object properties: seeking confirmation
  • From: Bill Hoffman <email@hidden>
  • Date: Mon, 04 Mar 2002 15:34:56 -0800

I'm pretty sure this is correct, but a quick confirmation from anyone would be helpful and appreciated.

In a handler declared within an AppleScript script object, the handler can _not_ create new properties of an object by assigning values to an otherwise undeclared property (a la JavaScript). The handler can _only_ get or set property values that are already declared as properties when the object is initially created. So with the following example:

script myObject
property name: "fred"
property age: 27
property occupation: ""

on updateObj()
set occupation to "janitor"
set income to 500
end updateObj
end script

when I tell a myObject variable to updateObj(), the "set occupation to 'janitor'" statement is fine, but the "set income to 500' statement will fail with an error, telling me that there is no such property as "income". I can't dynamically create a new property of an object at runtime in this manner (like I could in JavaScript, for example, with "this.income = 500;")

If there's a way to do that I'd love to know how, but I'm pretty sure there isn't.
_______________________________________________
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.
  • Follow-Ups:
    • Re: script object properties: seeking confirmation
      • From: "Serge Belleudy-d'Espinose" <email@hidden>
  • Prev by Date: Re: Now is: Finder tell block
  • Next by Date: OS X vs. classic AS compatibility
  • Previous by thread: Re: Creating a double-clickable Terminal script
  • Next by thread: Re: script object properties: seeking confirmation
  • Index(es):
    • Date
    • Thread