← Back to team overview

sikuli-driver team mailing list archive

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

 

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

So I work in a psychology lab. Basically, I have over 300 hour-long videos, and at some point in the video, a picture will be displayed where the participant has a big facial reaction (based on how they rated the picture). The 11 second reaction I want to clip can happen at any point in the video and is one of about 30 different photos.

I'm trying to write something that will  find the picture (the computer screen is also recorded), stop the video and record the 11 second reaction, then on a loop, continue onto the next video, and the next and the next. I have done that part. But it's only now that I've realized that I need the "picture" variable defined at the top to change in almost every video. Here's what I have:
-----

picture= ("4230-1.png")
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
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;

----
It may not be perfect code, but I've tested it and it does exactly what I want, but only for one video with one picture. I just need it to be able to switch the "picture" variable.

Does anyone know how or if I can specify a different picture for every repetition of the loop? I have an Excel Spreadsheet with all the corresponding picture ID names, in order, that can be used to tell Sikuli what picture file to insert as the new "picture" variable for each loop.

This would help so much!

Thanks,
Eric

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