• 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: "Arthur J Knapp" <email@hidden>
  • Date: Mon, 16 Apr 2001 10:24:24 -0400

> Date: Sat, 14 Apr 2001 23:43:00 -0500
> From: "Neal A. Crocker" <email@hidden>
> Subject: Re: Coerce String to Handler?

> on makereference(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, from:target} -- this line
> won't compile. replace with line above to compile
> end script
> run script refscript
> end makereference
>
> set blah to makereference("bar", {bar:2})
> {blah, blah + 1} -- {bar of {bar:2}, 3}

I wasn't able to make the above work, but I can see where you
were going, and this is very clever. ;-)


You can deal with the "won't recompile" issues by using properties
like this:

property kLeft : ASCII character 199 -- Email-friendly
property kRight : ASCII character 200 --

property kProp : run script (kLeft & "class prop" & kRight)


In fact, I find it more convienient to define chevron-items as
properties:

property kLeft : ASCII character 199
property kRight : ASCII character 200

property kForm : run script kLeft & "class form" & kRight
property kWant : run script kLeft & "class want" & kRight
property kSeld : run script kLeft & "class seld" & kRight
property kFrom : run script kLeft & "class from" & kRight

property kUsrp : run script kLeft & "constant ****usrp" & kRight
property kProp : run script kLeft & "class prop" & kRight

on makereference(propname, target)
script refscript
{class:reference, kForm:kUsrp, kWant:kProp} & ,
{kSeld:propname, kFrom:target}
end script

run script refscript

end makereference


> set blah to makereference("bar", {bar:2})
> {blah, blah + 1} -- {bar of {bar:2}, 3}

I get error "Can't make +data obj 00000001... into a number".



Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden

Hey, check out:
<http://developer.apple.com/techpubs/macos8/InterproCom/AppleScriptScripters
/AppleScriptLangGuide/>


  • Prev by Date: Ping OSAX
  • Next by Date: Chooser scripting
  • Previous by thread: Re: Coerce String to Handler?
  • Next by thread: Re: Coerce String to Handler?
  • Index(es):
    • Date
    • Thread