• 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? - SOLVED!!!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coerce String to Handler? - SOLVED!!!


  • Subject: Re: Coerce String to Handler? - SOLVED!!!
  • From: "Neal A. Crocker" <email@hidden>
  • Date: Wed, 18 Apr 2001 23:02:30 -0500

Subject: Re:Coerce String to Handler? - SOLVED???
Date: Wed, 18 Apr 2001 08:08:10 -0600
From: Ehsan Saffari <email@hidden>
To: <email@hidden>

<snip>

Thanks to Neal and all others who responded. But...

What I had in mind was to be able to do this all in one script
application, all subroutines are predefined.

Then the first solution (reproduced below) is perfect for you. Just use it in the script which you save as a script application. I originally said that solution 1 only works within a compiled script, but it would be more accurate to say it only works within the body of a single script, when there's no application-to-application communication involved, regardless of whether that script is saved as a compiled script or a script application.

-- Material below is "first solution" reproduced from another post.

Now, here are the the solutions. The first solution allows a script to "coerce" a string to a reference to a handler whose name is given by the string. It works for a handler of a compiled script. ....

!!!!!! Both solutions contain lines with attached comments saying the line will not compile. Such lines are simply the result of a transformation which ocurrs when the original line (shown above each uncompilable line as a commented line) is compiled. In order to comilple the script examples below, you must delete the lines which will not compile and replace each one with the line above it. You must, of course, uncomment the replacement line. !!!!!!

!!!!!! In the script examples below, the character combinations "<<" and ">>" are used to represent the chevron characters given by Option-\ and Shift-Option-\ !!!!!!



First solution, for handlers of compiled scripts. In the example below, a reference to handler "add1" of script "me" is produce and then use to call the handler:

-- start of script
on makehandlerreference(propname, target)
script refscript
--{class:reference,<<class form>>:<<constant ****usrp>>, <<class want>>:<<class prop>>, <<class seld>>:propname, <<class from>>:target}
{class:reference, <<class form>>:<<constant ****usrp>>, <<class want>>:property, <<class seld>>:propname,
  • Prev by Date: Re: [ot] best way to send an e-mail with Applescript
  • Next by Date: Re: Random number generator without duplicates?
  • Previous by thread: Coerce String to Handler? - SOLVED!!!
  • Next by thread: more info for person in Now Up-to-Date event
  • Index(es):
    • Date
    • Thread