Secure Global Desktop Administration Guide > Applets > setText (terminal emulator applet)
void setText(strString)
The setText method sends the specified text
(strString) to the application being displayed by the
terminal emulator applet.
Note The sendKey method
is also available, which lets you send special action keys to
applications.
<SCRIPT LANGUAGE="JavaScript">
function showDir() {
document.applets["Tarantella Terminal Emulator"].setText("ls");
document.applets["Tarantella Terminal Emulator"].sendKey("Return",0);
}
</SCRIPT>
<FORM>
<INPUT TYPE=button VALUE="Directory listing" onclick="showDir()">
</FORM>
This example adds a button beneath the terminal emulator applet.
When a user clicks the button, Secure Global Desktop sends the
characters l and s followed by a carriage
return to the application. If this application is a UNIX shell, these
characters are interpreted as an instruction to run the
ls UNIX command. This command lists the contents of the
current directory.
This example also uses the terminal emulator applet's sendKey method to send the
carriage return keystroke needed to run the command.
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 lines
that invoke the setText and sendKey methods to access
the terminal emulator applet used by your new theme.
Copyright © 1997-2005 Sun Microsystems, Inc. All rights reserved.