findAny() finds and highlights text but unable to print or assign text found to varible.

Asked by Nitin Chaudhari on 2019-12-06

Hi RaiMan, Masuo,
Thansk for help always for Sikuli related queries. Appreciate support.

In my earlier implemenation; used findAny() many times and results were as expected.
But in current implemantation; am using same logic, piece of code but not getting what am expecting.
find Any() finds and highlight the text but unable to assign textfound to variable and unable to print (its shown as blank).
hence if condition always failing.
Please suggest any workaround for this problem.

Refer the 2 pieces of code using findAny() .

------working code(Server Log In Check)----------
new_reg = findAny("1574757249877.png",Pattern("1574758943877.png").similar(0.97))
for match in new_reg :
    hostchk = match.text() assigning to variable here for comparion in if loop
    print hostchk
if hostchk == "Lastlogin":
   popup ("Logged in vmXXXXX")
   print ("Logged in vmXXXXX")
   type("cd /home/nitin/vbatest" + Key.ENTER)
   type("pwd" + Key.ENTER)
   type("ls -lrt" + Key.ENTER)

------------- Issue Code (File Permission Check)------------
 per_reg = findAny(Pattern("1574924837057.png").similar(0.95),Pattern("1574933369933.png").similar(0.90))
   for match in per_reg :
       permsn = match.text() ## assigning to variable here for comparion but it shows blank.
       print permsn # here prints as blank in result window.
if permsn == '755' :
        print "Permission is OK"
        popup ("Permission is 755 ")
   else :
        print "Permission is Not OK"
        popup ("Permission is 664 ")

Nitin Chaudhari

Question information

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

apparently the text cannot be read in case 2. (possible font problem?)

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.