← Back to team overview

sikuli-driver team mailing list archive

[Question #246387]: Code for reviewing loading bar through out the script

 

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

Hi,

I'm working on automating a process, the script is almost done! but the problem is when sikuli is alternating between the difference fields of the software -I have to mention that the software is oracle and old as shit- the loading bar starts loading to show that oracle is still processing or busy. I need to write a code that detects when the loading bar starts loading so Sikuli can pause the script and wait for it then continue where it left once the loading bar stops loading, here is what i have so far;

r = Region(1095,959,179,16) # the region were the loading bar is located at
Settings.MoveMouseDelay = 0

def changed(event):
    print "something changed in ", event.region
    for ch in event.changes:
        ch.highlight() # highlight all changes
    sleep(1)
    for ch in event.changes:
        ch.highlight() # turn off the highlights
    wait(Pattern("1396280999791.png").exact(),FOREVER) #a photo of the loading bar while it's not loading/busy 
    Settings.isChanged = True
    event.region.stopObserver()
    print "Stopped Loading"
    
r.highlight(1)
print "Checking loading bar"
r.onChange(25, changed)
Settings.isChanged = False

r.observe(360*24*60*60) 

if Settings.isChanged: 
    print "Status: Loading"
else:
    print "Status: Not Loading"

I have almost zero knowledge about coding i'm fairly new at this but i know this code works cause i tested it out. So i just need help knowing where to place it in the script cause I need it to constantly be checking the loading bar through out the entire script.

Thanks in advance!  


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