HyperCard 2.1: Sending Apple Events to Claris Resolve (11/92)

You can send almost any Claris Resolve Script command from HyperCard 2.1
to Claris Resolve using Apple Events. Claris Resolve, however, has a 254
character limit for each "dosc" event (the event which HyperCard sends with
the HyperTalk "Send" command.

You will generally receive a -1708 error as theResult of your Send command
if you exceed this limit.

The following handler will allow you to send scripts of any length from
HyperCard to Claris Resolve in the most efficient manner possible. It
sends as many lines as possible within the 254 character limit.

on mouseUp
put empty into scriptChunk
put 0 into counter
put 1 into i
repeat until i > the number of lines in field "Script"
add ( the number of chars in line i of field "Script" + 1 ) to counter
if counter > 254 then
send scriptChunk to program "Claris Resolve"
If the result is not empty then
answer the result
exit mouseUp
end if
put empty into scriptChunk
put 0 into counter
else
put ( line i of field "Script" & space ) after scriptChunk
add 1 to i
end if
end repeat
send scriptChunk to program "Claris Resolve"
answer "Your script is complete!"
end mouseUp

Where:
* Field "Script" is a field containing the Claris Resolve script you wish
to send (you may need to specify it as a card field if it is not a
background field).
* It is assumed in this example that Claris Resolve is already running on
the same machine.
* Modifications to this script are required if you wish it to launch Claris
Resolve or if it resides on a different machine. In the second case, you
need to specify the full network pathname of the application.
* This method does not allow for logical structures such as For loops or IF
statements. Logical structures must be sent in one complete chunk or errors
will occur.

You can also create a simple loop that sends the commands one line at a
time. This method, however, will be slower - especially when sending
events across a network.


This article is adapted from the Claris Tech Info database.
Published Date: Feb 19, 2012