I have a desktop automated robot where I’m using OCR to find a text in a pop-up window through a loop (it takes a while for the popup to load). If the text is found, a button needs to be clicked.
From time to time it happens that the text is not found. I’m not sure why. If that happens, the robot keeps processing the ocrsearch action because of the loop. This consumes all of my OCR conversions (500 max / pro license).
I was wondering if there is a possibility to maximize the number of conversions per OCRsearch action, to say 10x and stop the macro if that happens. Or maybe some other workaround to solve this issue.
I am glad to hear that you found a solution. Just to clarify: The OCRSearch does not do any retries. It is different from e. g. XClick | image where it retries to find the image until timeout. OCRSearch or XClick | ocr= is done once and then the text is returned.
The issue is that I must wait for a popup to show. When it does, I have to click a button inside the popup. The popup doesn’t show immediately. Sometimes it takes a second, sometimes 5 for instance. So I started with xclick | ocr= to search for the popup caption text.However, when it takes to long there is a timeout. Therefor I needed to use a loop (do repeatif).
The problem is that the caption text is sometimes not found. Can’t tell you why, because when I test it, it’s always found. When the macro runs unattended it’s sometimes not found. Then this loop is running until the OCR count is maxed. If so, I can’t restart the macro again.
So now I use a combination of the loop and the counter to stop if the loopcount is maxed.
Maybe there is a better way, but it works. It could be nice to have a variable somewhere to input the max number of OCR tries.