Forum Discussion

david_vickers's avatar
david_vickers
Occasional Contributor
5 years ago

Waiting for OCR checkpoint to appear as screen loads

I'm using a OCR checkpoint to wait for a Citrix application and display a login prompt.  When the window appears there's a brief loading screen that displays before the login prompt that I'm using th...
  • david_vickers's avatar
    david_vickers
    5 years ago

    AlexKaras  Discovered the reason for the "Invalid Text" error.  When selecting the parameters in the Keyword test area, for setting the parameter I was using a String type instead of Object type.  The solution from the support site actually works really well for me. The only issue with it is that it's a infinite loop, so I modified the sample code and used a for loop instead to emulate a 10 second timeout (I could also pass another parameter for the seconds) 

     

    function CheckTextContents(textToSearch)
    {
      // Recognize the text contents of the specified onscreen object (Citrix window)
      var text = OCR.Recognize(Aliases.wfica32.wndTransparentWindowsClient).FullText;
      // Search for the occurrence of the specified substring in the recognized text
      return (aqString.Find(text, textToSearch, 0, false) > -1)
    }
    function WaitForText(textToWait)
    {
      for (x = 0; x < 10; x++) { 
        if (! CheckTextContents(textToWait))
          Delay(1000);
        else
          break;
      }
    }