← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #167838]: get and then set text in specific region

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- OCR / getText from Region
the currently (rc2) available Region.text() is based on tesseract and still experimental. It is neither reliable nor flexible nor configurable (bug 710586). They work on an optimized version for rc3 (I do not know the status).
If you want to contribute in any aspect, contact Sean (Tsung-Hsiang Chang <vgod@xxxxxxx>) directly.

--- relative coordinates
all find and action commands are relative to a given region. If you use them without a region like find(), click(), ... they operate on the standard region SCREEN, which is a constant reference to Screen(0) (you can find more in the docs).
so you either say reg.find() to restrict to the region reg or use the with reg: construct, which redirects all unqualified functions inside the block to reg.

--- set new text in input field
many people use a find() operation with an image having target offset, to locate an input field and click on the target offset to give focus to the input field. normally this ends up in the current content to be selected. Then you use type() or paste() to fill in text and hit enter or tab.
For fixed layouts I prefer to only find one fixed spot of the dialog window and then use calculated/measured offsets to click (give focus to) the input fields. In many cases you can use tab to step through the fields.

--- recognize input fields
Sikuli has no feature to recognize anything by GUI element type - only image and text search to define a pixel location on the screen to act on. The script workflow designer has to have this knowledge and translate it to Sikuli scripting as matching images.
There is one exception: the App class is able to return the app windows as regions (some restrictions apply - look docs).

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