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

Hey,
This is my first project, so I’m new with Sikuli. I’m trying to make a 
conditional desktop surveillance which waits for multiple patterns. If some 
certain combination turns up, one of two bottom should be clicked and the 
script continue.

I have found something a bit like what I want in question 149688 (Thanks to 
RaiMan), but it dosen't seem to work. I would like Sikuli to wait for image1 to 
show up together with image2 or image3 to show up with image4. If image1 and 
image2 shows up, bottom1 should be clicked and if image3 and image4 shows up, 
bottom2 should be clicked.
Eventually when a bottom has been clicked, the script should move on. (I know 
however that the loop in the presented script will only stop when 
"imagestop.png" is not visible).
When i run the script, I receive following error message:

[error] script [ Test ] stopped with error in line 25 at column 4     # Which 
is at "if isImg3 and isImg4:"
[error] SyntaxError ( "no viable alternative at input 'if'", )

Does this mean I have to make an "else" for this to work since it says that 
there is no alternative?

Kind regards, 
Casper


Script: 

isImg1 = False
isImg2 = False
isImg3 = False
isImg4 = False

while exists("imagestop.png", 0): # loop as long imgstop is visible
    if exists("image1.png", 0):
       isImg1 = True
    if exists("image2.png", 0):
       isImg2 = True
    if exists("image3.png"), 0):
       isImg3 = True
    if exists("image4.png", 0):
       isImg4 = True
    if not (isImg1 or isImg2 or isImg3 or isImg4): # no img visible?
       wait(1) # time to be adjusted
       continue # we look again
    # at this point we know which images are present
    # some code to do something depending on
    # which images exist e.g.
    if isImg1 and isImg2:
       click("Bottom1.png")
    if isImg3 and isImg4:
       click("Bottom2.png")
    #prepare to loop again
    isImg1 = False
    isImg2 = False
    isImg3 = False
    isImg4 = False
    wait(1) # time to be adjusted
    # we go back to loop again
 # first statement after the loop


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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to