← Back to team overview

sikuli-driver team mailing list archive

[Question #239619]: need to speed up the code

 

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

I have this code, and I need to find one of those images in a small window of time (15 seconds). It actually works, but i can't search more than 64 images because it becomes too slow and I need to find 1 image over 300 images on the final code.
Is there any way to speed up this process? I rly mean ANY WAY.


r = Region(Region(734,589,410,247))
r2= Region(Region(882,849,340,166))#trigger region
count = 0
while (count < 10):
    r2.wait(Pattern("trigger.png").similar(0.90), FOREVER)#trigger
    img = Screen(0).capture(Region(822,638,231,141))
    import shutil
    shutil.move (img, 'c:/a/a(%d).png' % count) 
    count = count + 1
    if (r.exists(Pattern("10H-10S.png").similar(0.99), 0) or r.exists(Pattern("10H-AH.png").similar(0.99), 0) or r.exists(Pattern("10H-AP.png").similar(0.99), 0) or r.exists(Pattern("10H-AS.png").similar(0.99), 0) or r.exists(Pattern("10H-JO.png").similar(0.99), 0) or r.exists(Pattern("10H-QP.png").similar(0.99), 0) or r.exists(Pattern("10H-QS.png").similar(0.99), 0) or r.exists(Pattern("10O-10P.png").similar(0.99), 0) or r.exists(Pattern("10O-AH.png").similar(0.99), 0) or r.exists(Pattern("10O-JH.png").similar(0.99), 0) or r.exists(Pattern("10O-AO.png").similar(0.99), 0) or r.exists(Pattern("10O-JS.png").similar(0.99), 0) or r.exists(Pattern("10O-KO.png").similar(0.99), 0) or r.exists(Pattern("10O-QP.png").similar(0.99), 0) or r.exists(Pattern("10P-10S.png").similar(0.99), 0) or r.exists(Pattern("10P-QP.png").similar(0.99), 0) or r.exists(Pattern("10S-10P.png").similar(0.99), 0) or r.exists(Pattern("10S-AH.png").similar(0.99), 0) or r.exists(Pattern("10S-AP.png").similar(0.99), 0) or r.exists( Pattern("10S-JP.png").similar(0.99), 0) or r.exists(Pattern("10S-KH.png").similar(0.99), 0) or r.exists(Pattern("10S-QO.png").similar(0.99), 0) or r.exists(Pattern("10S-QS.png").similar(0.99), 0) or r.exists(Pattern("AH-10P.png").similar(0.99), 0) or r.exists(Pattern("AH-10S.png").similar(0.99), 0) or r.exists(Pattern("AH-QP.png").similar(0.99), 0) or r.exists(Pattern("AH-QS.png").similar(0.99), 0) or r.exists(Pattern("AO-10O.png").similar(0.99), 0) or r.exists(Pattern("AO-JS.png").similar(0.99), 0) or r.exists(Pattern("AO-KO.png").similar(0.99), 0) or r.exists(Pattern("AO-KP.png").similar(0.99), 0) or r.exists(Pattern("AP-10P.png").similar(0.99), 0) or r.exists(Pattern("AP-JS.png").similar(0.99), 0) or r.exists(Pattern("AS-AO.png").similar(0.99), 0) or r.exists(Pattern("AS-QS.png").similar(0.99), 0) or r.exists(Pattern("JH-10H.png").similar(0.99), 0) or r.exists(Pattern("JH-AH.png").similar(0.99), 0) or r.exists(Pattern("JO-10O.png").similar(0.99), 0) or r.exists(Pattern("JO-AP.png").similar(0.99), 0) or r.exists(Pattern("JO-JP.png").similar(0.99), 0) or r.exists(Pattern("JO-KS.png").similar(0.99), 0) or r.exists(Pattern("JO-QO.png").similar(0.99), 0) or r.exists(Pattern("JP-JO.png").similar(0.99), 0) or r.exists(Pattern("JP-KO.png").similar(0.99), 0) or r.exists(Pattern("JP-KP.png").similar(0.99), 0) or r.exists(Pattern("JP-QS.png").similar(0.99), 0) or r.exists(Pattern("JS-10P.png").similar(0.99), 0) or r.exists(Pattern("JS-AO.png").similar(0.99), 0) or r.exists(Pattern("JS-AS.png").similar(0.99), 0) or r.exists(Pattern("JS-JO.png").similar(0.99), 0) or r.exists(Pattern("KH-JH.png").similar(0.99), 0) or r.exists(Pattern("KH-KO.png").similar(0.99), 0) or r.exists(Pattern("KH-QH.png").similar(0.99), 0) or r.exists(Pattern("KO-JH.png").similar(0.99), 0) or r.exists(Pattern("KO-JP.png").similar(0.99), 0) or r.exists(Pattern("KP-10O.png").similar(0.99), 0) or r.exists(Pattern("KP-AH.png").similar(0.99), 0) or r.exists(Pattern("KS-10P.png").similar(0.99), 0) or r.exists(Pattern("KS-AP.png").similar(0.99), 0) or r.exists(Pattern("KS-JP.png").similar(0.99), 0) or r.exists(Pattern("KS-JS.png").similar(0.99), 0) or r.exists(Pattern("KS-KH.png").similar(0.99), 0) or r.exists(Pattern("KS-QO.png").similar(0.99), 0) or r.exists(Pattern("QH-AP.png").similar(0.99), 0) or r.exists(Pattern("QH-AS.png").similar(0.99), 0)):
        img = Screen(0).capture(Region(725,389,490,105))
        import shutil
        shutil.move (img, 'c:/a/b(%d).png' % count)
        doubleClick(Region(1332,817,74,34))
        doubleClick(Region(1391,908,215,83))
    else:
        doubleClick(Region(882,849,340,166))#clicking the trigger restarts the loop.

k. that's it.
Thank you guys!
btw I'm no programmer so problably my code is looking like shit.

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