Skip past navigation linksSecure Global Desktop Administration Guide > Applets > getText (terminal emulator applet)

getText (terminal emulator applet)

Syntax

Skip past command syntax or program codestring getText( [ strLine, strCol, ] strLength)

Description

This function retrieves text from the terminal emulator screen.

If you specify a position to retrieve text from (using the optional strLine and strCol parameters), this method returns strLength characters of text from the specified position.

If you don't specify a position in this way, this method returns strLength characters of text from the current cursor position.

The screen coordinates strLine and strCol coordinates are calculated from the top left corner of the emulator screen and begin at line 0, column 0.

If the position and number of characters you specify mean the method attempts to retrieve text from beyond the end of a line, this method returns an empty string. For example, in an 80 column screen, invoking the method with getText(0,70,10) will return the last 10 characters of the first line. However, invoking the method with getText(0,70,11) returns an empty string (since the method tries to retrieve the 81st column in the 80 column display).

Examples

Skip past command syntax or program code<SCRIPT LANGUAGE="JavaScript">
 
function fiveByTen() {
   output = ""

   for (var line = 0 ; line < 5 ; line++) {
      current_text = document.applets["Tarantella Terminal Emulator"].getText(line, "0", "10");
      output = output + current_text + "\n"; 
   }

   alert(output);
}

</SCRIPT>
 
<FORM>
   <INPUT TYPE=button VALUE="Display Text" onclick="fiveByTen()">
</FORM>

This example adds a button beneath the terminal emulator applet. When a user clicks the button, Secure Global Desktop displays the first 10 characters of the first 5 lines of the terminal emulator screen.

Add the code to the HTML document containing the terminal emulator applet (tde.html, in the sco/tta/standard webtop theme), after the TTAAPPLET declaration.

Note This example assumes you are using the sco/tta/standard webtop theme. If you're using another theme, with different frame names and layouts, or different applet names, you'll need to modify the line that invokes the getText method to access the terminal emulator applet used by your new theme.

Related topics