Input "enter" until an OCR text appears

Hi team,

Brand new to UIpath - I’m trying to have it press enter to cycle through my screen until a certain OCR image appears. How do I loop this input and have it stop once that image appears?

Not sure if I’ve provided information on this.

Cheers,

Richard

Hi @richardli23

welcome to uipath community
Kindly use On image appear activity
this activity will check whether the image appears or not and the output will be type boolean and name it bool_imageexists
–use a if condition and mention the condition like this
bool_imageexists = True
if the above condition passes it will go to THEN part where we can include the click activity or
if it fails it will go to ELSE part where we can include any activity that we need to perform if no image appears

Hope this would help you
Kindly try this and let know for any queries or clarification

use a if condition

Cheers @richardli23

@Palaniyappan’s answer is right for an image (as you wrote), but your title is saying “OCR text”, so, you can do:

getOCRTextActivity --> into String_OCR
AssignActivity --> Bool_Press_Enter = NOT String_OCR.contains("The_text_you_want")

While Bool_Press_Enter = true
{
       getOCRTextActivity --> into String_OCR
       AssignActivity --> Bool_Press_Enter = NOT String_OCR.contains("The_text_you_want")
       SendHotKeyActivity --> press Enter
}

It’s pretty much what I would do, not sure it’s the best

Thanks for the help Pika, as I am new I’m have a bit of trouble understanding how to input what you have suggested into UiPath studio. Are you able to help? Thanks again

Great
but OCR means image i guess…
Optical Character Recognition

So i hope that would work
Cheers @richardli23

@Palaniyappan
Thank you for your help - I am trying it now and come back to you if any issues!

1 Like

Fantastic
Cheers @richardli23

@Palaniyappan
I can getting an error saying "Boolean type cannot be converted to UIPath.Core.UiElement.
Any advice here?

May i know at which activity we are getting this error
Cheers @richardli23

On Image Appear - I have named the output bool_imageexists and create the variable and set the variable type to Boolean.

@Palaniyappan
I have changed from on image appear to “OCR text exists” activity. The only part I am missing is “enter” until OCR text appears - any suggestions on this?

@Palaniyappan Yes, but because he was searching for a text in an image, I was assuming the typo could change (and it’s why Character Recognition would be better than Image Recognition in this case, but slower)

Perfect @richardli23, I didn’t pay attention to this “OCR text exists”.
You already resolved the error for the Boolean type.

For sending “enter”, you have the “send Hotkey” activity
For the “until OCR text appears”, you should just host it in a “while” loop where you get the new value of bool_imageexists and getting his new value each time inside the loopand you send “enter”

Sorry if it’s not clear, you can post your .xml file if you want us to see the errors.

If you have some times, there is the “UiPath Academy” which can be usefull for helping you, but it’s quite long if you already have a developper’s background.

1 Like