• 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: Run Handler-Name from Text?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

Best
Thomas


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

  • Follow-Ups:
    • Re: Run Handler-Name from Text?
      • From: Christopher Stone <email@hidden>
References: 
 >Run Handler-Name from Text? (From: Christopher Stone <email@hidden>)
 >Re: Run Handler-Name from Text? (From: Tom Robinson <email@hidden>)
 >Re: Run Handler-Name from Text? (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Run Handler-Name from Text?
  • Next by Date: Re: Run Handler-Name from Text?
  • Previous by thread: Re: Run Handler-Name from Text?
  • Next by thread: Re: Run Handler-Name from Text?
  • Index(es):
    • Date
    • Thread