SecureCRT supports many standard escape sequences. The following is a list of the xterm sequences supported by SecureCRT.

Note: The mouse tracking information is provided for users developing applications for remote systems in order to support mouse tracking. Typically this implementation will be transparent to the user. SecureCRT supports X10 mouse tracking.

General Sequences

Action

ESC ] 2 ; title BEL

Set text parameters; change window title to title

 

 

Mouse Tracking Sequences

Action

ESC [ ? 9 h

Send mouse X and Y on button press

ESC [ ? 1000 h

Send mouse X and Y on button press and release and scroll wheel movement

Example Script: Changing the Window Title

SecureCRT supports the xterm escape sequence for changing the session window title bar on the fly. The Perl script below shows how this can be done:

#! /usr/local/bin/perl

# title.pl - sends xterm escape sequence to

# change window title to @ARGV

 

$esc = "\x1b";

$bel = "\x7";

 

$txt = join(" ", @ARGV);

 

print $esc, "]2;", $txt, $bel;

This script can be placed in a shell alias to display the current working folder in the title bar of the session window:

alias cd 'cd \!\!* ; prompt ; ~/bin/title.pl $host\: `pwd` '

Color Extension Support

SecureCRT supports many color extensions introduced for xterm versions that need to support more than 16 colors. For 256-color xterm escape sequences to work, you must have the ANSI Color option enabled in the Terminal/Emulation category of the Session Options dialog.

Note: In the following table, the variable RgbSpec is in the form rgb:RR/GG/BB where RR, GG, and BB are hex values specifying the color.

RGB Sequences

Action

ESC [ 38 ; 5 ; <RgbSpec> m

CSI 38 ; 5 ; <RgbSpec> m

Set foreground color.

ESC [ 48 ; 5 ; <RgbSpec> m

CSI 48 ; 5 ; <RgbSpec> m

Set foreground color.

ESC ] 4 ; c ; <RgbSpec> ST

ESC ] 4 ; c ; <RgbSpec> BEL

Change Color Number c to the color specified by RgbSpec. Any number of c name pairs may be given. The color numbers correspond to the ANSI colors 0-7, their bright versions 8-15, and if supported, the remainder of the 88-color or 256-color table.

ESC ] 1 0 ; <RgbSpec> ST

ESC ] 1 0 ; <RgbSpec> BEL

Change foreground color to RgbSpec.

ESC ] 1 1 ; <RgbSpec> ST

ESC ] 1 1 ; <RgbSpec> BEL

Change background color to RgbSpec.

ESC ] 1 2 ; <RgbSpec> ST

ESC ] 1 2 ; <RgbSpec> BEL

Change cursor color to RgbSpec.

Example Script: Laying Out a Color Cube

The following Perl script demonstrates using these sequences to lay out a "color cube" with a colored "X" in each color cell:

---

#!/usr/bin/perl

$ESC="\x1b";

$CSI="${ESC}\[";

for ($green=0;$green<6;$green++)

{

     for ($red=0;$red<6;$red++)

     {

         for ($blue=0;$blue<6;$blue++)

         {

             $bgcolor=16+($red*36)+($green*6)+$blue;

             $fgcolor=16-$red-$green-$blue;

             print "${CSI}48;5;${bgcolor}m";

             print "${CSI}38;5;${fgcolor}mX";

         }

         print "${CSI}0m";

         }

     print "\n";

}

---