← Back to team overview

sikuli-driver team mailing list archive

[Question #686715]: findAny() finds and highlights text but unable to print or assign text found to varible.

 

New question #686715 on Sikuli:
https://answers.launchpad.net/sikuli/+question/686715

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




-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.