← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #685479]: [HowTo] Use Region to speed up execution

 

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

David Borghi posted a new comment:
Thank you RaiMan.

I decided to simplify the script as I wasn't using the most "complex"
part of it.

Just to be clear, whenever a click is executed, img1 "disappears" (it
changes from 0 to something, for example, "1"). The script is only
"activated" when another image pops up on the screen (img11 and img12).

I think I didn't get some points (like the someRegion), I'll try to
rewrite the script as per your orientation.

That's how the script is now (without the Region implementation):

img1 = "img1.png"
img11 = "img11.png"
img111 = "img111.png"
img12 = "img12.png"
img121 = "img121.png"

def do(a, ab, abc):
    if not (exists(a, 0) and exists(ab, 0)):
        return

    click(abc)

    while exists(ab, 0):
        wait(0.1)

while True:
    do(a="img1", ab="img11", abc="img121")
    do(a="img1", ab="img12", abc="img111")

Should it be something like the script below? (As I said, I didn't get
the usage for someRegion.)

img1 = "img1.png"
img11 = "img11.png"
img111 = "img111.png"
img12 = "img12.png"
img121 = "img121.png"
reg = Region(653,1129,1902,310)

def do(a, b, ab, abc, reg):
    ma = reg.exists(a, 0)
    mab = reg.exists(ab, 0)
    if not (ma and mab):
        return

    reg.click(abc)

    while mab.exists(ab, 0):
        pass

while True:
    do(a="img1", ab="img11", abc="img121")
    do(a="img1", ab="img12", abc="img111")


I'll upgrade. 

Thank you for your help and attention.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.