1 Reply Latest reply on Jun 15, 2018 8:20 AM by emeamolly

    I need help with Scripting

    Mike.kelley@gm.com Rookie

      I need to play a sound when users get a message for the first time, I had this functionality working in Naurtech, Examples below. My wavelink script is configured to execute on screen changes. The problem is that text stays in place through additional screen updates before the next successful output, the results are with every tab and move within the screen this sound plays. A solution may be waiting until the user presses enter, I tried changing the setting from when screen updates to after keystroke of enter 0D and it breaks the software because I can no longer hit enter to logon.

       

      Script for Wavelink:

      Script( BeepTest2 )

      String( text2 )

      Boolean( Successful )

      Activate( On_Key, 0xd, None )

          text2 = Get_Screen_Text( 15, 1 )

      Successful = String_Equal( "successful.", text2 = String_Left( text2, 11 ), 0, TRUE )

      If( Successful )

              Play_Sound( "Beep.wav" )

          End_If

      Return

       

      Script for Naurtech:

      // Written by Naurtech Support for Case 19328

      //

      //   - Sounds a beep when it finds a unique text "Processing" on row 14, col 1

      //     and text "successful." on row 15, col 1

       

       

      function OnSessionReceive(currentSession, count)

      {

          // -----------------------------------------------------------  

          // This script looks for a special text on the screen of emulation

          // session S1 and then plays a beep if the text is found. 

          //

          // TODO: You can change the session in which you would like to

          //       look the text

          //

          // TODO: You can change the text string to look for. Presently

          //       this script does a case independent text match

          //

          // TODO: You can change beep and play a WAV file to sound

          //       text match is detected. Make sure that the WAV file

          //       exists on the specified file path

          // -----------------------------------------------------------

         

          // TODO: Change the pattern regular expression as required to

          // change the unique text match strings

      var pattern1 = /Processing/gi;

      var pattern2 = /successful./gi;

       

       

         

          // TODO: Change the matching text string locations if required

          //

          var line1 = CETerm.Session(currentSession).Screen.GetTextLine( 14 );

          var line2 = CETerm.Session(currentSession).Screen.GetTextLine( 15 );

         

          //

          // Look for the unique text; pattern 1 on line 1 and pattern 2 on line 2

          // Do a regular expression case-insensitive match

          //

          if ((line1.match(pattern1)) && (line2.match(pattern2)))

          {

              // Uncomment next line to display a message prompt.

              // OS.Alert( "Found Text!! ");

                     

              // Sound a beep or play a WAV file if text is found

              // TODO: Change the file name and path to play a different WAV

              // file. Make sure that the WAV file exists on the device

              // OS.PlaySound("\\Windows\\beep.wav", 0);

              //OS.Beep();

              OS.PlaySound("\\flash disk\\beep.wav", 0);       

          }

      }