Re: Coerce String to Handler?
Re: Coerce String to Handler?
- Subject: Re: Coerce String to Handler?
- From: Jeffrey W Baumann <email@hidden>
- Date: Sun, 15 Apr 2001 09:41:42 -0500
I think what we need is something analagous to Javascript's "eval"
function. In Applescript, it would work something like this (notice I'm
throwing in proposed syntax for "name of this handler" too):
on handler1(handler1param)
set myName to name of me as string -- we need this syntax too
set x to myName & " received " & handler1param
return x
end handler1
set testhandler to "handler1"
set testparam to "any word"
set testval to eval(testhandler & "(" & testparam & ")")
--> "handler1 received any word"
Jeff Baumann
email@hidden/email@hidden (dual citizenship!)
www.linkedresources.com
At 6:06 +0200 14/04/01, Timothy Bates wrote:
If anyone at apple was keen, calling by name is a fantastic capability
for a
language, and is really essential for handling html forms which can
have
variable variables, if you get what I mean.
a suitably verbose syntax could be
my x as named variable
or
contents of x as variable
set x to "iac"
on iac()
beep
end iac
And on Saturday, April 14, 2001, at 06:20 PM, Emmanuel responded:
Not sure I understand. 'run script' does something like calling by name.
The matter here is more a matter of availability of the handler (the
question of the context). In applets (or, in the text windows of Smile),
which have permanent contexts, you can run:
----------------
on iac()
beep
end iac
run script("iac()")
----------------
Script Editor's windows may not run properly this script.
HTH
Emmanuel
_______________________________________________
applescript-users mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/applescript-users