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

Asked by Nitin Chaudhari

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() .

1.
------working code(Server Log In Check)----------
new_reg = findAny("1574757249877.png",Pattern("1574758943877.png").similar(0.97))
for match in new_reg :
    match.highlight(1)
    uprint(match.text())
    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)

2.
------------- 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 :
       match.highlight(1)
       print(match.text())
       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 ")
--------------------------------------------------------------------------

Regards,
Nitin Chaudhari

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
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.