• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Coerce String to Handler?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Coerce String to Handler? (From: Emmanuel <email@hidden>)

  • Prev by Date: Scripting Palm Desktop?
  • Next by Date: Re: Filemaker checking value lists
  • Previous by thread: Re: Coerce String to Handler?
  • Next by thread: Re: Coerce String to Handler?
  • Index(es):
    • Date
    • Thread