sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #14426
Re: [Question #213476]: Able to see custom data?
Question #213476 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/213476
Status: Open => Answered
j proposed the following answer:
There are two alternatives to updating the screenshots:
1.
Try to use OCR(Optical Character Recognition):
For this you need a Region that contains the name and if possible only the name and no other text.
Then you can do this:
# create Region that contains only the desired name, how you do this depends on your GUI.
region = Region(x,y,w,h)
# extract the text with OCR and remove leading and trailing whitespaces
name = region.text().strip()
# check the name
if (name = "John"):
#do john stuff
elif(name = "Paul"):
#do paul stuff
OCR can be very good or useless, depending on your font, fontsize and
language, you'll have to try.
2. If the name in the GUI can be selected(highlighted), you can use this for the following:
# find Position of the name by using a nearby key image and doubleclick on the name to select the word (doubleclicking on a word usually selects the whole word)
doubleclick("keyimage.png").targetOffset(x,y)
# copy name to clipboard
type("c",KEY_CTRL)
# get the name and remove leading and trailing whitespaces
name = Env.getClipboard().strip()
# check the name
if (name = "John"):
#do john stuff
elif(name = "Paul"):
#do paul stuff
I hope one of this methods works for you
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.