Using OCR to detect a specfic text and then tigger something

Dear users,

I want to use automation to log in to a website which offers for example cinema seats and search for an available seat. The website shows a table with no rows when there is no seat ( the head column is still there ).
I have used OCR and anchored the top column as the red area in OCR & then selected the below rows as green area. Currently as there is no seat, the green area will be blank ( white only ), so the app gives me this error:

  • [info] Executing: | OCRExtractRelative | OCRseats_dpi_192.png | result |
  • [info] OCR (eng) started (983 byte)
  • [error] Line 7: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type undefined
  • [info] Macro failed (Runtime 7.57s)

I want to program somehow that when the OCR return empty, it goes back to clicking a link and wait aain for the table. Once the OCR detected “anything” in the green area, it triggers an action, like sending a message on Telegram or anyting that can be done in the software.

Your help is very much appreciated.


Well for now I found out that using online OCR works, so there must be some problem with my local OCR installation. However the rest of the question remians. How to use a loop ( if then else maybe ) and how to trigger an action like sending SMS or Telegram message.

For this error please see Why does OCRExtract when using XModule Local OCR throw an error but online mode works fine? - #12 by admin

You can use the XRUN command to start a Powershell, Python, (etc) script. Then this script will send the SMS message.

See for example how to send SMS to mobile from Powershell - Stack Overflow

Thank you very much for the answer. Another question is that how I can write an IF condition like this:

if ($result == null) {
go to to step one // no seat has found
} else {
function_to_send_SMS () // seat is found

Another question is that to avoid reconition of this procedure as a robot by the server I would need to define random wait time during the process. I know that using “pause” will cause wait time, but how can I have a random pause time between for example 10-30 seconds.

Thanks :slight_smile:

@admin Any idea about what I asked 2 weeks ago

Please try again with the new Version V8.2.7 (released today)