Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!jkc From: jkc@Apple.COM (John Kevin Calhoun) Newsgroups: comp.sys.mac.hypercard Subject: Re: AppleEvent limitation in HC 2.1? Message-ID: <53931@apple.Apple.COM> Date: 13 Jun 91 01:55:18 GMT References: <1991Jun12.154845.1@f.adelaide.edu.au> <53912@apple.Apple.COM> Organization: Apple Computer Inc., Cupertino, CA Lines: 42 Dr. Pradhan and I exchanged a couple of e-mail messages, and we finally figured out what the problem was. He was sending HyperCard a line of HyperTalk like the following: put "" into field x I don't know why I didn't remember this before -- HyperTalk can't handle single lines longer than 255 characters! Therefore the line above won't work, whether you try to execute it locally or send it to HyperCard in a "do script" event. Because of this limitation, neither the "do script" event nor the "evaluate expression" event is a good way to send large chunks of data to HyperCard. I suggested that he define an Apple event for setting the contents of a field, class "WILD" and id "SFLD", like so: on appleEvent class,id,sender if class & id is "WILDSFLD" then -- class = "WILD", id = "SFLD" request appleEvent data -- direct parameter contains field number put it into fieldNum request appleEvent data of type 'STUF' -- contains text for field put it into theStuff if there is a field fieldNum then put theStuff into field fieldNum else reply error "No such field" else pass appleEvent end appleEvent You can make this event a great deal fancier -- specifying whether the field is a card or background field, specifying it by name, number, or id, specifying even the card and stack to which it belongs. In the future, when HyperCard supports the Apple event object model and the core suite of Apple events, you would probably use the standard "set data" event instead of a made-up one like "SFLD". But in the meantime, you're free to define and use Apple events for your own purposes and to tell HyperCard how to handle them by writing appleEvent handlers. Kevin Calhoun jkc@apple.com