Home Page
        Orders     Downloads     Support     Contact     Deutsch
ZOC Terminal is a professional SSH Client and Terminal Emulator for Windows and macOS.
ZOC Online Help Topic:

Programming ZOC (REXX/DDE) → Introduction to ZOC AppleScript Programming (macOS)

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
The ZOC commands themselves work as if they are issued from within ZOC's native scripting engine (REXX) and even the syntax is similar. To perform one of those, you simply put them into the script in function call syntax (the same syntax which you use to call a subroutine which resides inside an AppleScript).

A simple AppleScript using a ZOC function will look like this:
 

tell application "zoc8"
    -- 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
Please see the list of available commands for a description of parameters (this list is also available directly from ZOC's help menu). The syntax and examples there are tailored to ZOC's internal REXX scripting engine, but their use from within an AppleScript as shown above should be self evident.

 

Calling ZOC Commands as via 'perform'
If you prefer to use a more AppleScript like syntax, you can also execute ZOC commands through the perform command. This command takes one direct parameter (the name of the ZOC command) and an array (in curly brackets) which contains the parameters (if any) to the respective command.

Using this variant is equivalent to the subroutine syntax. It merely provides a convenient alternative:
 

tell application "zoc8"
    -- 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)

 

Downloads
Orders
Contact
Support
Terms of Use
Privacy Policy
pixel