Re: Run Handler-Name from Text?
Re: Run Handler-Name from Text?
- Subject: Re: Run Handler-Name from Text?
- From: Thomas Fischer <email@hidden>
- Date: Tue, 17 Apr 2012 10:10:56 +0200
Hi Christopher,
I don't know if this helps at all but you can do something like this:
set handlerRecord to {myCriterionA:myHandlerNameA, myCriterionB:myHandlerNameB, myCriterionC:myHandlerNameC}
set myHandler to myCriterionB of handlerRecord run script myHandler
script myHandlerNameA return "Eureka! A works." end script
script myHandlerNameB return "Eureka! B works." end script
script myHandlerNameC return "Eureka! C works." end script
Unfortunately, in this situation you can't use a variable with value "myCriterionB", and you can't use quotes in the record's values. Probably someone can come up with something better.
Am 17.04.2012 um 04:53 schrieb Christopher Stone: On Apr 16, 2012, at 21:38, Tom Robinson wrote: You should be able to do it with 'run script':
______________________________________________________________________
Hey Tom,
I've tried a number of variations of 'run script'.
Given this:
------------------------------------------------------------------------------------------------ on myHandlerNameB() return "Eureka! It works." end myHandlerNameB
set lookUpTable to " myCriterionA myHandlerNameA() myCriterionB myHandlerNameB() myCriterionC myHandlerNameC() "
set handlerToRun to do shell script "sed -nE 's/^myCriterionB +(.+)/\\1/p' <<< " & quoted form of lookUpTable ------------------------------------------------------------------------------------------------
Please demonstrate how to successfully make 'run script' use handlerToRun as a parameter.
Thank you.
-- Best Regards, Chris
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden