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:

APPENDIX → Extended Escape-Sequences

The following escape-sequences extend the normal range of sequences (the normal sequences define the behavior of ZOC depending on the chosen each emulation).

Their main purpose of the extended sequences is to allow a host to control specific features or invoke specific actions through ZOC.

The sequences typically start with ESC ] (hex 1B 5D) or ESC [ (hex 1B 5B), followed by a variable part and a termination character like ^G (hex 07) or CR (hex 0D).

Other characters in the syntactic samples below denote themselves, except for spaces (which should be ignored) and text in brackets (which is a placeholder for a variable part of your own choice).

For example, a valid implementation of the sequence ESC ] 0 ; <title> ^G is the byte series hex 1B 5D 30 3B 5A 4F 43 07 (set window title to "ZOC").

On most Linux systems, you could emit the sequence from the example above via echo -e "\e]0;ZOC\a". On programming languages that use C-like strings (C, C++, Python, Perl, PHP, …), you can use something like print "\033]0;ZOC\007";.

       
Change Window Title: ESC ] 0 ; <title> ^G
 

The sequence allows the remote program to change the title for the window (or tab) in which the session runs.

Change Window Title (alternate): ESC [ | $ t = <title> CR
 

The sequence is an alternate version of the above and also allows the remote program to change the title of the window.

Clear Screen and Reset Emulation: ESC ] R
 

A byte sequence of hex 1B 5D 52 will perform a clear screen and emulation reset (this is identical to the user choosing Clear Screen from the View menu).

Change Window Title: ESC ] 52 ; c ; <base64-data> ^G
 

The OSC52 sequence allows the remote program to put text to the clipboard according to the OSC 52 protocol (requires activation of the 'Start Local Command', see below).

Start Local Command: ESC [ | <command> CR
 

A host can send this sequence to perform a command locally through ZOC.

Important: Since this is a potential security risk, the sequence is ignored, unless the option to allow it is set in the Options→Session Profile→Advanced. Alternately, the sequence is also processed, if a file named remoterun.flg exists in the ZOC program folder (Windows) or if a file named .zoc8_remoterunflag exists in the user's home folder (macOS).

The command is passed to Windows through the CreateProcess API and it can contain optional parameters, e.g. notepad.exe newfile.txt or through a cmd.exe C:\Windows\system32\cmd.exe /c dir >out.txt. Under macOS you can run programs directly (/bin/touch /tmp/didit.txt). Tasks which require shell features (e.g. output redirection), will need to run through a shell e.g. /bin/bash -c ls ~/Downloads >/tmp/out.dir or through shell as a shell script /bin/bash /Users/you/thetask.sh

If the command parameter starts with https://, https:// or ftp://, the URL will be passed to user's the default web browser.

If the command starts with the text %SHELLOPEN% followed by a space character and a file name, the file will be opened through the operating system using the user's chosen default program, e.g. %SHELLOPEN% C:\ZOC\piechart.jpg

There are also some placeholders: DOWNLOADDIR, LASTDOWNLOADEDFILE, LASTSPOOLFILE.
When these appear either between percent-signs (e.g. %LASTDOWNLOADEDFILE%) or in brackets after a dollar sign (e.g $(LASTSPOOLFILE)), they will be replaced by their respective values before executing the command. A typical sample could be a host sending a report to the user via Zmodem and then opening it via %SHELLOPEN% "%DOWNLOADDIR%\thereport.pdf" or %SHELLOPEN% "%LASTDOWNLOADEDFILE%"

NetTerm Compatibility: ESC [ ] <parameter> ESC [ <n> *
 

ZOC supports a range of sequences from NetTerm to perform operations on the local computer that runs the terminal.

The parameter <n> is a decimal number which determines the function to perform. The meaning of the <parameter> thus depends on <n> as described below:

0 - URL to open in the local browser, e.g. ESC [ ] https://www.emtec.com/ ESC [ 0 *.
1 - Command to perform locally (same as the 'start local command' sequence above).
2 - Perform a ZOC action (this is an action string, like actions which you will find if you look at a ZOC session profile file using an editor, when you go to the user button section).
6 - Directory to use as the download directory.
7 - Directory to use as the upload directory.
8 - Name and path of file to transfer when the next upload is invoked.
11 - Text to write to the local clipboard.
12 - Full path and name of a file to open using the associated default program for that file's type. The placeholder %LASTDOWNLOADEDFILE% can be used to refer to the last file that was received through a download.
17 - The text NOWAIT. In this case, the last downloaded file will be opened on the local computer (using the default program for that file's type).
17 - The text PRINT. The last downloaded file will be sent to the printer that is configured in Program Settings→Printer.

17 - The text DELETE. The last downloaded file will be deleted.

Example: ESC [ ] C:\DOWNLOADS ESC [ 6 * (hex 1B 5B 5D 43 3A 5C 44 4F 57 4E 4C 4F 41 44 53 1B 5B 36 2A will subsequently (for this session only) store downloaded files in the folder C:\DOWNLOADS\.

Example: ESC [ ] C:\DOWNLOADS\REPORT.PDF ESC [ 12 * will open the file REPORT.PDF on the local computer, using the default viewer for PDF files.

Example: ESC [ ] ^RUN=postprocess.zrx ESC [ 2 * will run the postprocess.zrx REXX script.

Example: ESC [ ] NOWAIT ESC [ 12 * will open the last downloaded file (e.g. MYREPORT.PDF) on the local computer, using the default viewer for PDF files.


Important: These sequences will only be processed, if the remoterun.flg is present on the system or if they are enabled under Options→Session Profile→Advanced (see 'start local command' above). Also, if you want to debug your use of these sequences, you can enable hex mode or ascii tracing in Options→Session Profile→Trace/Debug.

 

 
← Back to APPENDIX

 

Downloads
Orders
Contact
Support
Terms of Use
Privacy Policy
pixel