script object properties: seeking confirmation
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.