Question #248545 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/248545

Eugene S proposed the following answer:
Hi,

Theoretically you have 2 options:
1. Using OCR features (as suggested in the previous post). You can try to use 
the built in OCR features to try and detect the value on the screen. Basic 
usage looks something like this:

Settings.OcrTextRead = True
value = find("value")

But here you have to keep in mind few things. First, as with any OCR,
you have to make sure that the value you are looking on the screen
appears only once. For example if that's a certain number you are
looking for, make sure that similar number does not appear somewhere
else on the screen. If there is a chance of that to happen, you will
have to define a limited area to look for the value. For example,
something like that:

region = find("pattern.png")
value = Region.text()

Second, the built-in OCR features are not 100% reliable and the result
depends very much on the text size and font. If that's just a regular,
small characters (for example like here), chances that it will be
recognized properly are very low. Here comes the second option.

2. Using copy / paste
For the reasons explained above, it might be a better idea to copy the text to 
clipboard rather than try to detect it using the OCR features. To do that, you 
will have to select the text (double click on it for example) and then copy it 
(Ctrl + C).

type("c", KEY_CTRL)

Then to access the text, you can get it from the clipboard like that:

value = Env.getClipboard()


See which way suits you most.


Cheers,
Eugene
When

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to