sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #36085
Re: [Question #260206]: How to read or get a string from text box or text area?
Question #260206 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/260206
IgorG proposed the following answer:
A possible solution may looks like:
matches = r.listText() # get the match regions occupied by the pixels of a word
for m in matches:
#m.highlight(1)
word = m.getText()
labelX = m.getX()
labelY = m.getY()
labelH = m.getH()
labelW = m.getW()
To compare the strings Python has a handy function SequenceMatcher in the library called difflib :
import difflib
def howSimilar(str1, str2):
return difflib.SequenceMatcher(None, str1, str2).ratio()
It suppose to return a number from 0 to 1.
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.