CETerm: Creating Custom HotSpots

Version 2

    Verified Product Versions

    Wavelink Naurtech CETerm 5.7

    Environment:

    CETerm 5.7

    How To Create Custom HotSpots:

    Within CETerm or any of the single emulation products, you can use the built in scripting functionality to implement custom / dynamic HotSpots. HotSpots are generally applicable only to terminal emulation sessions. The user can tap any visible location on the host application screen to trigger some "control" to be sent to the host application. The host application can then invoke appropriate business logic based on the received key / control codes.

     

    If required, you can customize the HotSpots based on specific host screens or specific sessions / host applications. To do so, the HotSpotcustomization script will require the ability to uniquely detect the screen or session.

    Below is a sample script that implements dynamic or custom HotSpots. This obviously will require to be modified to work with your host application. It will however give you an idea on the recommended implementation.

     

    The CETerm script simply looks for a match of the custom hotspot text stings on every screen of your host application. Once a match is found, it will send the number preceeding the text to the host application to invoke the corresponding menu choice. You can however send any action response to your host application.

     

    If you have not done so already, you should review the CETerm Scripting Guide for better understanding. This is available under the support section of our website.

     

    Download the code in the attached zip file:

     

    /*OnStylusDown*/
    function OnStylusDown( session, row, column )
    {
        // ---------------------------------------
        // Look for custom "hot-spot". Get the row
        // of screen text on which the stylus was
        // tapped by the user 
        // ---------------------------------------
        var screen = CETerm.Session( session ).Screen;
        var text = screen.GetTextLine( row );
        
    
    
        // ---------------------------------------
        // Check to see if one of the menu items 
        // is on this screen text row. 
        // 
        // TO DO: If you need to use this script 
        // with different host application menus,
        // please edit the text string matches here 
        // ---------------------------------------
        var sIDA = "IDA_ENTER";
        var sText  = "";
        var sMatch = false;
    
    
        if (text.match( /1.RECEIPT/ ))
        {
           sText = "1";
           sMatch = true;
        }
        else if (text.match( /2.TRANSFER/ ))
        {
           sText = "2";
           sMatch = true;
        }    
        else if (text.match( /3.REPRINT LABELS/)) 
        {
           sText = "3";
           sMatch = true;
        }
        else if (text.match( /4.CREATE ORDER/)) 
        {
           sText = "4";
           sMatch = true;
        }    
        else if (text.match( /5.PICK ORDER/)) 
        {
           sText = "5";
           sMatch = true;
        }    
        else if (text.match( /6.CHANGE PRINTER/)) 
        {
           sText = "6";
           sMatch = true;
        }    
        else if (text.match( /7.SUPERVISOR MENU/)) 
        {
           sText = "7";
           sMatch = true;
        }        
        else if (text.match( /ESC/))
        {
           sText = "";
           sIDA = "IDA_ESC";
           sMatch = true;
        }
    
    
        // ---------------------------------------
        // If one of the menu text items were found
        // then send the appropriate text to the host
        // for that menu item selection
        // ---------------------------------------
        if (sMatch)
        { 
           // Uncomment this next line if you want a beep
           // sound on a menu selection match
           // OS.PlaySound( "default.wav", 0 );
           
    
    
           // Uncomment this next line to debug
           // OS.Alert("Sending " + sText);
    
    
           CETerm.SendText( sText, session );
           CETerm.PostIDA( sIDA, session );
        }
    }