Velocity: Disable scanner by cursor position

Version 2

    Environment:

    Velocity 1.2.108  

     

    Problem / Issue:

    I need to disable the "Internal" scanner at a certain cursor position.

     

    Solution:

    This can be achieved by the use of the scripting engine within Velocity:

     

    Note:

    Velocity uses 0 as the first place holder. For example if in a native Telnet client your cursor appears at Row 2 Column 1, in Velocity, you would use the coords of Row 1, Column 0.

     

    Sample Script:

    The below script will run each time a screen is Loaded.. This is important to remember when this is being utilized. This script will Beep and disable the "Internal" Scanner whenever the cursor is at Row 1 Column 0. when a new page loads and the cursor does not match the IF statement, the scanner will be enabled.

     

    This can be linked to a session or individual screens.. if linking to individual screens please make sure that the scanner is enabled ....

     

    function onPos(event)

    {

    var position= Screen.getCursorPosition();

         if(position.row == 1 && position.column == 0)

              {

              Device.beep(1000,200,10);

              Scanner.enable(false);

              }

    else

               {

               Scanner.enable(true);

               }

    }

    WLEvent.on("ScreenUpdated", onPos);