Web Terminal Scripting

Green Screens Web Terminal enables custom scripts to be added through web admin console. With help of jQuery and GreenScreens WEB API it is possible to improve web terminal by adding specific features or additional custom features required by clients.

Scripts can be added as a standard JavaScript <script> tag or as a link to an external JavaScript library..

If you are a web developer, probably you are familiar with $(document).ready() function and similar approaches. As web terminal have it's own initialization process, we have implemented similar ready event for custom scripts initialization.

In order to access Green Screens Web Terminal API and register events API has to be initialized. Global window event โ€˜greenscreensโ€™ will be triggered when terminal is initialized and custom scripts must be initialized after โ€˜greenscreensโ€™ event.

Here is an example:

  // execute when new screen arrives
  function onScreen(cfg, obj) {
          // print out current screen hashes
          console.log('attr : ' + cfg.attrHash);
          console.log('flds : ' + cfg.fldHash);

  // listen for application startup event
  $(window).on('greenscreens', function(){
     // lsiten for an event when new terminal screen is rendered
     Tn5250.Application.listen('display', onScreen);

Save example in web terminal footer box. (donโ€™t forget to wrap script into <script> tag).

After reloading web terminal, this script will execute automatically and print screen hashes inside browser console whenever new screen arrives.

Now we can map those screen hashes to different functions to be executed for screen automation. Read about automation in one of next customization blogs.