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.
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.
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.