← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #675373]: [HowTo] make a simple loop with "exists image" and "click image"? (Sikuli)

 

Question #675373 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/675373

    Status: Open => Answered

RaiMan proposed the following answer:
a variant based on what I understood from comment #9

while True:
  if exists("img1", 0):
    while True: 
      #wait for img11 and then
      #look for img11 or img12 FOREVER
  
      # this is step1
      if exists("img1", 0) and exists("img11", 0): # check for img11
        doubleClick("img111")
        while exists("img11", 0): 
          wait(0.3) # wait for img11 to vanish
  
      # this is step2
      if exists("img1", 0) and exists("img12", 0): # check for img11
        doubleClick("img121")
        while exists("img12", 0): 
          wait(0.3) # wait for img12 to vanish
  
      if not exists("img1"):
        break # when img1 vanishes, end the inner loop

  # img1 not there   
  wait (10) # wait and then repeat

the job:
when img1 exists
   when img11 is there
     doubleclick and wait for img11 to vanish
   when img12 is there
     doubleclick and wait for img12 to vanish
   repeat until img1 vanishes

"the job" is repeated every 10 seconds

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