Utilizing a prompt command for a desktop automation

Hi,

I am working on a desktop application using Nitro where a search for an expression is done and OCRExtractrelative is used to retrieve the number of times it is found. It works fine when the number of times the expression is found has two or more digits. However, when it has only one digit, OCRExtratcRelative cannot extract the value and returns blank. I tried to have a specific image and OCRExtractRelative for only one digit with several different positions for the green and pink boxes but, unfortunately, it doesn’t work. This is one issue.

I thought of using the prompt command to solve the previous issue, instead of reading the number of times using OCRExtractRelative. The user would type the result of the search if the number is not extracted by the OCR. However, the pop-up of the prompt command does not show on top of the Nitro screen, the icon of UI Vision on the taks bar starts to blink. The problem with this is that when the user switches to UI Vision most of the times the pop-up isn’t there. When the pop-up can be reached, after the answer, the macro crashes because it is not on Nitro. In other words, to avoid this, how the prompt pop-up can be shown on top of Nitro, instead of on top of UI Vision desktop? This is a second issue that came up when I tried to work around the first.

Thanks in advance!

For the OCR issue, can you please post a few screenshots (with one digit)? Indeed, one-digit number OCR can be tricky, but I think with Engine2 it should work.

For the “Display prompt” workaround: You can use XRunAndWait + VBS file to show an input box that is on top of everything:

Dim sInput
sInput = InputBox("Enter number")
MsgBox "You entered:" & sInput
' Send exit code to UI.Vision 
WScript.Quit sInput

Inside your macro you get the return value (exit code) with ${!xrun_exitcode}

See also Problem with xrun when running batch file with bat extension or converted exe file - #9 by ulrich

2 posts were split to a new topic: Single-digit number-OCR

Hi admin,

Thanks for the tip. I changed the code to use it and it works fine!

Best regards,

Hi admin,
I received your e-mail on how to improve data capture with OCRExtractRelative. Althouguh I could not found it here in the Forum, I’d like to say it worked fine and thank you for the information.
Best regards

Thanks for the feedback, great to hear that it works. Just FYI: I had split the posts between “prompt command that remains on top” (this post) and how to improve number OCR to make it easier for future readers.