← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #208869]: How to read a number from a field in desktop application?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
2 options:
--1. Region.text()
--2. copy-to-clipboard and Env.getClipBoard()

-- option 1: (first choice)
First you have to try, wether the OCR feature reads the number correctly (but high probability that it fails)
an easy test:
r = selectRegion()
print r.text()

when you run this script, select a region that contains the number with as little background as possible.
If this works, you can use this function. But be aware, that it is not very reliable.

-- option 2: (fall back)
If there is any method, to select the number, so copy-to-clipboard (ctrl/cmd-c) copies the number to the clipboard, then you can use Env.getClipBoard() to get the clipboard content into your script.
But: there is a bug: Env.getClipBoard() and paste() cannot be used in the same script

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