← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #265835]: Defining new variable (picture) for each loop

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
this is an example for a principal approach:

pictures = []

# this might be revised as a loop to fill pictures
App.focus("chrome") # Be sure Chrome is open to the correct spreadsheet
type(Key.DOWN) #Moves cursor down to select new participant ID for each loop
type("c",KeyModifier.CTRL) #Starts on ID xxxx and copies ID
picture = Env.getClipboard() # reads clipboard content
print picture # to see what it contains
pictures.append(picture) # add image to the list

# example for a list containing some image filenames
# to simulate the usage with a filled pictures list
pictures = ("4230-1.png", "4230-2.png", "4230-3.png", "4230-4.png")

for picture in pictures:
  click("1429908306921.png") #brings focus to the explorer folder with videos in it
  click(Pattern("1429908644602.png").exact()) #Insert the name of where you'll be searching
  type("v", KeyModifier.CTRL) #pastes ID copied above
  wait(2)
  if exists(Pattern("1429908782248.png").exact()):
     doubleClick(Pattern("1429908782248.png").exact())
     wait(2)
     type("t", KeyModifier.CTRL)
     type("010735")
     type(Key.ENTER)
     Settings.ObserveScanRate = 5.0 # Sikuli searches screen 5 times/second
     while exists(picture, FOREVER): #Pauses VLC during picture, captures 11 second reaction and closes VLC. Exports to My Videos
         click("1424897770073.png")
         type(Key.LEFT, KeyModifier.ALT) # Be sure 'short jump back' hotkey is set to 9 seconds in VLC
         click("1429909306834.png")
         click("1429909283119.png")
         wait(12)
         click("1429909306834.png")
         click("1429909438710.png")
         break
     else:
         pass
  else:
     pass;
  App.focus("search")
  click("1429909648444.png")
  click(Pattern("1429909709906.png").similar(0.91))#Brings search ability back;

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