← Back to team overview

sikuli-driver team mailing list archive

[Question #654244]: Waiting for image, type command, then waits again

 

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

I am looking for a simple script that will watch for an image, type the letter c until the image is gone. then wait for the image to come back again indefinitely. 

I have looked at many videos and tutorials and they all have huge amounts of code that all differ from each other. 

Settings.MoveMouseDelay = 0
running = True

def runHotkey(event):
    global running
    running = False

Env.addHotkey(Key.F1, KeyModifier.ALT, runHotkey)
#for step in range(5): #for i in range(0,40):

hover("1501408565660.png")
for i in range(0,40):
     while exists("1501408565660.png")and running:
          click("1501409544348.png")
     click("1501408565660.png")

     if exists("1501413313685.png"):
          sleep#(30)

     if exists("1501410531123.png"):
          sleep#(30)
          
     if exists("1501413618782.png"):
          sleep#(30)

This kinda works but there has to be a much better way. Also the script wont end right away when I try to stop it. It lags for more than 3 mins before stopping. 

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