Re: Coerce String to Handler?
Re: Coerce String to Handler?
- Subject: Re: Coerce String to Handler?
- From: "Neal A. Crocker" <email@hidden>
- Date: Sun, 15 Apr 2001 00:26:38 -0500
pardon me for the double-posting, but some characters got mangled in
the original post. In the following script, the character
combinations << and >> should be entered into Script Editor as left
and right chevrons (or right and left; I forget which is which). The
charcters << can be achieved as single chevron character by typing
"Option-\" and the characters >> can be achieved as a single chevron
character by typing "Option-Shift-\".
Original post (corrected for mangled characters) follows:
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 makereference
set blah to makereference("bar", {bar:2})
{blah, blah + 1} -- {bar of {bar:2}, 3}
Subject: Coerce String to Handler?
To: <email@hidden>
From: Ehsan Saffari <email@hidden>
Date: Fri, 13 Apr 2001 08:53:54 -0600
Hi
Is it possible to coerce a string to a handler name
so the handler can be executed?
set x to "iac"
my handler x()
--> Can't make "iac" into a handler.
on iac()
beep
end iac
cheers
ehsan