• 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: Dynamic Handler Call
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamic Handler Call


  • Subject: Re: Dynamic Handler Call
  • From: Jens Eliasson <email@hidden>
  • Date: Sat, 8 Apr 2006 18:15:28 +0200

8 apr 2006 kl. 18.01 skrev Gary Beberman:

I would like to create a list of records in which each record has a text string and a handler name associated with the string. So, it would look like:

set hlist to {{searchtext: "text string 1", hname: "handler1()}, {searchtext: "text string 2", hname: "handler2()}, . . . }

A user selects the text from a list, the script finds the associated hname and calls the handler.

The problem is I don't know if there's a way to call a handler whose name is embedded in another object. Is there something like "run handler (hname of item 3 of hlist)"?

Thanks,

Gary

Check out the Scripting Commands in the Standard Additions scripting addition. With the run script command you can do exactly what you are asking for. But if you feed text to this command it has to interpret it every time, so it will be slow if these are tasks with many repetitive run script commands.


In some scripting applications that I've done earlier I have generated script code that the script saves to a text file. Then you may use load script and in that case the script is interpreted once and compiled in memory. I used it for interpreting date and time reporting formats from a settings file that the script then used very often. It worked really well.

/Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Store script as run only (From: has <email@hidden>)
 >Re: Store script as run only (From: Jens Eliasson <email@hidden>)
 >Dynamic Handler Call (From: Gary Beberman <email@hidden>)

  • Prev by Date: Re: Dynamic Handler Call
  • Next by Date: Re: Dynamic Handler Call
  • Previous by thread: Dynamic Handler Call
  • Next by thread: Re: Dynamic Handler Call
  • Index(es):
    • Date
    • Thread