← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #267986]: Watch out for 4 different Images followed by 4 different Keyboard inputs. Scanning all images all the time.

 

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

Hashtag123 posted a new comment:
Thanks for the tipp. I found the Regions but I am not sure how to use
them.

This is my code:

   while True:                     #I want this to loop forever
       if not exists("GO_RIGHT.png"): #This is the image I'm searching for
           type(Key.LEFT)         #If the image is not there I want the left arrow key to be pressed indefinite times
           else type(Key.RIGHT)         #If the image appears I want the right arrow key to be pressed once
           while True:                     #I want this to loop forever
               if not exists("GO_LEFT.png"): #This is the new image I'm searching for
                   type(Key.RIGHT)         #If the image is not there I want the left arrow key to be pressed indefinite times           
               else type(Key.LEFT)         #If the image appears I want the right arrow key to be pressed once
               break                        #I want the script to start at the beginning in line 1

First of all. would this work?
And second. I know how I can define a Region:

def Region_with():
   reg = Region(596,406,63,85)   #This is the region I would like Sikuli to scan
   reg.highlight(5)                #This confirms it is looking at the area

Image "GO_RIGHT.png" will always appear in the same region and image
"GO_LEFT.png" will always appear in the an other region. How can I add
the regions to my script - which I can't test right now :/

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.