OCRExtractRelative and the coordinates of the captured text

Hi everyone!

I have a question. I’m using OCRExtractRelative to read captions on a few buttons on a website and if I like what one of the buttons says (the captions change dynamically) then I want UI.Vision to click that button.

I’m very new to this (started using the software yesterday), and so far I managed to read out the captions and do some operations on the captured text (string comparisons and such). But how can I pass the coordinates of these buttons to XClick?

Can I get OCRExtractRelative to tell me the x and y coordinates of the text it’s reading? Or at least the screen coordinates of the green or pink box that it’s using for OCR?

If I could know the coordinates of either the green or pink box then I should be able to just hard-code the coordinate offset for each button, because their size and position relative to either the pink or green box are always the same…

Can OCRExtractRelative tell me the coordinates of the boxes on screen?

Thanks a lot for any advice!

The coordinates should be inside the ${!imagex} and ${!imagex} variables. Or ${!ocrx} and ${!ocry} if you use OCRExtractTextRelative.