While not being fully AppleScript aware, ZOC offers a simple interface to execute ZOC-Commands from within an AppleScript.
In order to prepare ZOC for the processing of those, the commands need to be enclosed between a start conversation and an end conversation command.
Calling ZOC Commands as Subroutines |
A simple AppleScript using a ZOC function will look like this:
-- prepare the current session in the first ZOC window
-- to process upcoming ZOC commands.
start conversation
-- send 'ls -l<enter>' to the remote host
ZocSend("ls -l^M")
-- call a ZOC function for user interaction and store the result
set reply to ZocRequest("Your preference?", "Apples", "Oranges")
-- release the command processing
end conversation
end tell
Calling ZOC Commands as via 'perform' |
Using this variant is equivalent to the subroutine syntax.
It merely provides a convenient alternative:
-- prepare the current session in the first ZOC window
-- to process upcoming ZOC commands.
start conversation
-- send 'ls -l<enter>' to the remote host
perform "ZocSend" using { "ls -l^M" }
-- call a ZOC function for user interaction and store the result
set reply to perform "ZocRequest" using
{ "Your preference?", "Apples", "Oranges" }
-- release the command processing
end conversation
end tell
← Back to Programming ZOC (REXX/DDE)