Asked by Nitin Chaudhari on 2019-11-26

Hi Team,
Thanks for support.

I am working on file upload function. Am getting file name in xls file(cell value)
Dont have any problem while getting filename from xls in variable.

I would like to find the filename in my application screen. once found the file name; I would lie to click and upload the file.
findText(variable) #variable have the filename
Tried with click ; but at times there are many files. And hence finding,uploading unexpected file.
Am not sure how to implement findtext feature in sikulix.
Sample code will be great help.

Nitin Chaudhari

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

you can try the following, if your file names are arranged as some lines in a Region:

reg = someRegion # to be defined somehow

lines = reg.collectLines()
# lines is a list of Match objects, one for each line found

for line in lines:
    print line.getText() # here you could check the line content as text
    #line.hover() # and click it in case

Nitin Chaudhari (cnitin) said : #2

Hi RaiMan,
I shall try the line and collectLine().
Nitin Chaudhari

Nitin Chaudhari (cnitin) said : #3

Hi RaiMan,
Tested with the collectLines() adding in my script.
Am getting error [lines = win_reg.collectLines() AttributeError: 'str' object has no attribute 'collectLines' ]
tried with collectLinesText() also but geeting same error.

code is as below:
 win_reg = ("1575617970943.png")
    lines = win_reg.collectLines() # getting error here
    for line in lines :
        print line.getText()
        winscrpt = line.getText()
        print winscrpt
Is this function is version limitation? I am using SikuliX1.1.3 currently.
Any suggestion for error above mentioned.

Nitin Chaudhari

Nitin Chaudhari (cnitin) said : #4

If collectLines() is available in SikuliX 1.1.4 onwards; please let me know for the alternative of collectLines() in version 1.1.3 .

RaiMan (raimund-hocke) said : #5

collectLines() in version 1.1.3: not available

1.1.4/2.0.x have a completely revised implementation of the text/OCR feature based on Tess4J/Tesseract 4

Can you help with this problem?

Provide an answer of your own, or ask Nitin Chaudhari for more information if necessary.

To post a message you must log in.