Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!jkc From: jkc@Apple.COM (John Kevin Calhoun) Newsgroups: comp.sys.mac.hypercard Subject: Re: AppleEvent limitation in HC 2.1? Message-ID: <53912@apple.Apple.COM> Date: 12 Jun 91 15:36:34 GMT References: <1991Jun12.154845.1@f.adelaide.edu.au> Organization: Apple Computer Inc., Cupertino, CA Lines: 48 In article <1991Jun12.154845.1@f.adelaide.edu.au> mpradhan@f.adelaide.edu.au (Malcolm Pradhan) writes: > > On the weekend I was playing with HC 2.1 and Macintosh Common Lisp (MCL) > v2.0b1p2, using AppleEvents to communicate between them. > > Everything works very nicely, except I have run into a problem which > may be a limitation of HC: when sending a 'dosc' or 'eval' AE to HC from > MCL I have found that HC will not accept more than 255 characters, if > the AE contains more than 255 chars HC ignores it altogether! > > Is this a set limitation of HC? When receiving an 'eval' event, HyperCard can handle expressions only up to 255 characters in length. In fact, HyperCard is doing the same thing that it does when an XCMD invokes the EvalExpr callback. However, when receiving a 'dosc' event, HyperCard can handle a script as long as 30000 characters. Sending this event to HyperCard is similar to invoking the RunXHandler callback from an XCMD. In addition to these limitations, there is one more, which I hope will be removed in a future release. When HyperCard receives an Apple event parameter of type 'list', it attempts to coerce it to text for use in HyperTalk. Unfortunately, the coercion handler limits the textual form of each item in the list to 255 characters. This is fine for the 'odoc' and 'pdoc' events, which contain lists of alias records as parameters, but it's not so good in other cases. If you're sending Apple events to HyperCard with parameters of type 'list', and the items in the list can be longer than 255 characters, there are two things you can do: 1) convert the parameter to text before sending it to HyperCard. 2) override HyperCard's built-in 'list' to 'TEXT' coercion handler with a better one. The 'dosc' event, as described in the Apple Event Registry, shouldn't use a parameter of type 'list'. It should send the script to be executed in a parameter of type 'TEXT', or it should send an alias record that resolves to a script file (HC doesn't have script files, and so doesn't support this), or it should send an object specifier that resolves to the script to execute (HC 2.1 doesn't support Apple event objects, so this won't work either at present). Hope this helps. Kevin Calhoun jkc@apple.com