Re: script object property contamination
Re: script object property contamination
- Subject: Re: script object property contamination
- From: Arthur J Knapp <email@hidden>
- Date: Sat, 09 Feb 2002 12:11:04 -0500
>
Date: 8 Feb 2002 05:36:12 -0500
>
Subject: script object property contamination
>
From: "Anthony Adachi" <email@hidden>
>
I9ve come across some strange script object behavior when one uses a
>
dynamically invoked handler (a.k.a.- handler as object method). i.e.-
>
when one assigns a handler to a variable and invokes it at a latter
>
time.
[snip long posting]
>
By the way, sorry for the long post but I thought it was important to
>
include examples of several different property acesses being made.
>
Since there appears to be a mix of both property values and handlers
>
getting scrambled inside the child's properties. The included script
>
objects below should illustrate the range of the problem.
I'm sorry, Anthony, but I suspect that you will receive very few
responses. While I can understand your desire to show the many
situations that you believe the problem covers, it is confusing and
frustrating to have to wade through so much code to even begin to
understand the problem. Could you post a simplified example of one
instance where this problem occurs?
I think you are having problems using the syntaxes "my" and
"of me":
script ParentObject
property theProperty : "a property of the parent"
on Parent_Get()
return theProperty
end Parent_Get
on Parent_Get_My()
return my theProperty -- or "theProperty of me"
end Parent_Get_My
end script
script ChildObject
property parent : ParentObject
property theProperty : "a property of the child"
end script
tell ParentObject
Parent_Get() -- --> "a property of the parent"
Parent_Get_My() --> "a property of the parent"
--
-- They work the same in both cases, because "my" refers
-- to the "current" object, ParentObject.
end tell
tell ChildObject
Parent_Get() --> "a property of the parent"
--
-- Same as before, because it looks for "anyProperty",
-- assuming it is a part of it's own scope.
Parent_Get_My() --> "a property of the child"
--
-- When we send a command to ChildObject, every use of
-- the word "me" or of "my" refers to the ChildObject,
-- even when that use occurs inside one of the parent's
-- handlers.
end tell
You can think of "my" or "of me" as a dynamic way of
referring to the object that is AppleScript's current
"target".
ParentObject's Parent_Get_My() --> ParentObject is the target of "my"
ChildObject's Parent_Get_My() --> ChildObject is the target of "my"
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
<
mailto:email@hidden>
try
<
http://www.goodbuddy.net/budco/sware/imscripts.htm>
on error number -128
end try
}
_______________________________________________
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.