Re: Coerce String to Handler?
Re: Coerce String to Handler?
- Subject: Re: Coerce String to Handler?
- From: Timothy Bates <email@hidden>
- Date: Sat, 14 Apr 2001 14:06:56 +1000
sorry, AppleScript does not support calling variables by contents (where you
can set the contents of a variable to the name of a second variable and then
call that second variable (in your case a handler) using the contents of the
first. There may be a kludge where you can set x to your handler as a
string, and then run x (which will compile the string into a script on the
fly), but this will be slow.
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
On 14/04/2001 12:53 AM, "Ehsan Saffari" <email@hidden> wrote:
>
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
Dr Timothy Bates <
mailto:email@hidden>
Macquarie Centre for Cognitive Science (MACCS)
Macquarie University
Ph 61 (2) 9850 8623
Fx 61 (2) 9850 6059