Re: applescript-users digest, Vol 2 #593 - 12 msgs
Re: applescript-users digest, Vol 2 #593 - 12 msgs
- Subject: Re: applescript-users digest, Vol 2 #593 - 12 msgs
- From: "Neal A. Crocker" <email@hidden>
- Date: Sun, 15 Apr 2001 23:57:01 -0500
Your'e right. While it works for script properties and record
properties depend on whether the second arg of makereference is a
script or record, it doesn't work with script handlers. I'll play
around with some more and possibly I can make it work. If I do, I'll
post it to the list.
Neal.
Message: 11
Date: 15 Apr 2001 14:52:53 -0400
Subject: Re: Coerce String to Handler Name?
From: "Anthony Adachi" <email@hidden>
To: email@hidden
Neal
How does your makereference(propname, target) handler work?
I'm trying to do something similar to what Ehsan is attempting and I
can't figure out how to use your handler.
What does your makereference handler return? A reference? I plugged in
the name of a handler located in a script object and the script object
into your handler. I got the following results.
set blah to makereference("handler_noParameters", scriptObj)
--> |handler_noParameters| of Gscript scriptObjH
blah is reference
--->false
What I'm working on is a script app which first finds out all the
script object's in a script whose name begins with "test". Then it
will find out all the handlers in each of those script objects whose
name begin with "test" as well.
From there the user will choose (from a list dialog box) which of
those found "test" handlers located in those "test" script objects one
wishes to execute. Once the selection(s) have been made the script app
will call the desired handlers.
I've run into two stumbling block's: how to extract those names
(handlers and scrlpt objects) from the script and how to call them via
coercing a name string to a handler name.
I thought your makereference() handler may be the solution to the
second problem. However, I can't figure out how it would work with
handlers.
Below is a snippette of some of the things I tried out.
-----start of script snippette example.
script scriptObj
on handler_withParameter(x)
x + 1
end handler_withParameter
on handler_noParameters()
beep 2
end handler_noParameters
end script
set blah to makereference("handler_noParameters", scriptObj)
--> |handler_noParameters| of Gscript scriptObjH
blah()
--> GscriptH doesn't understand the blah message.
contents of blah
--> Script error.
handler blah
--> Script error
blah is handler
--->false
blah is reference
--->false
blah is script
--->false
-----end script snippette
On Sun, Apr 15, 2001 1:11 AM, "Neal A. Crocker"
wrote:
>Try the following:
>
>on makereference(propname, target)
> script refscript
> --{class:reference,<<class form>>: <<constant ****usrp>>,
><<class want>>: <<class prop>>, <<class seld>>:propname, <<class
>from>>:target}
> {class:reference, <<class form>>: <<constant ****usrp>>,
><<class want>>:property, <<class seld>>:propname, from:target} --
>this line won't compile. replace with line above to compile
> end script
> run script refscript
>end makereferenc