RE: Who has that property?
RE: Who has that property?
- Subject: RE: Who has that property?
- From: "Scott Babcock" <email@hidden>
- Date: Mon, 7 Nov 2005 14:00:46 -0800
- Thread-topic: Who has that property?
This may indeed be a Script Debugger issue. I tried my code on a clean machine without Script Debugger and got the same result you're seeing. I still think there's value in the discussion, however, if it's applied to embedded script objects instead of loaded script libraries.
property foo : "parent foo"
property baz : "parent baz"
script bar
property foo : "script foo"
property yatz : "script yatz"
end script
set theList to { ¬
{ref foo of bar, ref foo of parent of bar}, ¬
{ref baz of bar, ref baz of parent of bar}, ¬
{ref yatz of bar, ref yatz of parent of bar}, ¬
{ref yop of bar, ref yop of parent of bar}}
repeat with thisItem in theList
refTest(contents of thisItem)
end repeat
get theList
--> {{true, true}, {false, true}, {true, false}, {false, false}}
on refTest(refList)
set {scriptRef, parentRef} to refList
try
set parentVal to (contents of parentRef)
get parentVal
set inParent to true
on error
set inParent to false
end try
if (inParent) then
set scriptVal to (contents of scriptRef)
set (contents of scriptRef) to null
set inScript to not ((contents of parentRef) = null)
set (contents of scriptRef) to scriptVal
else
try
set scriptVal to (contents of scriptRef)
get scriptVal
set inScript to true
on error
set inScript to false
end try
end if
set (item 1 of refList) to inScript
set (item 2 of refList) to inParent
end refTest
I ran this code on Script Editor just to be sure it works. However, since I need to work with Script Debugger as it is, still have to detect and compensate for the "loaded script library property scope" bug.
Thanks for keeping me honest ;)
> Date: Mon, 7 Nov 2005 19:36:34 +0000
> From: has <email@hidden>
> Subject: RE: Who has that property?
> To: email@hidden
> Message-ID: <a05200f03bf9557511cae@[82.3.92.252]>
> Content-Type: text/plain; charset="us-ascii"
>
> Scott Babcock wrote:
>
> >Yes, referring to "lib2 of lib2" directly results in an error.
> >Try this, though:
> >
> >set libRef to (a reference to lib2 of lib2)
> >handler1() of (get contents of libRef)
> >
> >I've run this code on 10.3.9 and 10.4.2 with Script Editor and Script
> >Debugger. It works just as I described.
>
> Added the above code to the original main script code then tested it on
> 10.2.8 and 10.4.2 with SE and Smile, and it errors as expected when
> attempting to get the reference's contents. (Though oddly SE and Smile
> report different errors, -1700 vs -1728.) You're definitely using the
> exact same code as you've posted here?
>
>
> >I failed to point out the
> >significance of using a reference to access the inherited property,
> >although this is the method used in whoHasLib2().
>
> Shouldn't make any difference other than delaying the point at which the
> script fails. Incidentally, your 'my' and 'a ref to' operators are all
> superfluous anyway and would best be removed.
>
> has
> --
> http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden