Finding OCR text position when there is a new line

Hey all!
So here is the issue I’m having.
I’m going to be given a list of items exactly like the are on the buttons minus the new lines, and I need
to Find OCR Text Position and click them.

So say they give me “Fit Farmer”, I need to use the whole string to search.
I can’t just use “Farmer” because there is another button with that word.
I can’t just use only “Fit” because I can’t ask them to give me only the unique words on the button.

I’ll have exactly “Fit Farmer” or “BanBerry Farmer” or “Farmers Choice”.
Now, if I look up “Farmers Choice” I get the right one because there’s no new line.
But if I look up “Fit Farmer” it won’t find it because of the new line.

Does anyone have any thoughts?

Thanks,
Logan

Hello Logan,

Welcome to the forums. Using OCR for something like this is the absolute last resort. Are you certain that you cannot use another method, such as the normal Click activity?

Fine
welcome to uipath community

lets do one thing
use FIND OCR TEXT POSITION and then CLICK activity within TRY block of TRY CATCH ACTIVITY

–inside the TRY block use FIND OCR TEXT POSITION where mention the string like “Fit Farmer” and if the bot is able to find such string, it will click on it
or it will fail

on failing it will go to CATCH block where we can mention the string to FIND OCR TEXT POSITION with NEWLINE in it like this
"Fit"+Environment.Newline+"Farmer"
and this will be now searched by the and clicked as well

Cheers @Logan.Albrecht

We’re working in a VNC viewer and we need it to be easily configurable, not hard coded image clicks or something, so it has to be OCR unfortunately, I think.

I’ve tried “Fit”+Environment.Newline+“Farmer” exactly and it just runs until it times out unable to find it.

There’s the remote runtime that may work, but I think it’s a long shot.

I’ve done something similar to what you’re doing. What I did was look for words and their locations. Because you know how big those boxes are, any words found are related to each other and should be read left to right, up to down based on their x/y coordinates. This is doable using Get OCR Text with its WordsInfo output.

I’m looking into that now. It needs to be installed on the machine I’m viewing, correct?

Yes, that’s correct. There’s also an accompanying plugin deal that needs to be installed on the bot PC.