← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #664345]: CPU usage going through the roof when running script

 

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

RaiMan proposed the following answer:
It is Python ;-)

i guess you tried to transform this:

if Screen(1).exists(Pattern("1516812605236-1.png").similar(0.90)):
        Screen(1).click(Pattern("1516812605236.png").similar(0.90))
        Screen(1).wait("1516812737846.png", 60)
        Screen(1).click(Pattern("1516812737846.png").targetOffset(320,134))

would get:
if Screen(1).exists(Pattern("1516812605236-1.png").similar(0.90)):
        Screen(1).click()
        Screen(1).wait("1516812737846.png", 60)
        Screen(1).click(Pattern("1516812737846.png").targetOffset(320,134))

Go back and understand:
instead of:
    if Screen(1).exists(Pattern("1516809781721.png").similar(0.90)):
        Screen(1).click(Pattern("1516809781721.png").similar(0.90))

use:
if regionOnScreen1.exists(image1, 0)): regionOnScreen1.click()

or better:
if regionOnScreen1.exists(image1, 0)): 
    regionOnScreen1.click()

With the click() you have to specify the region, that remembered the match to click!
Screen(1) in your case.

BTW:
once at the beginning say
screen1 = Screen(1)

and use screen1 later instead of Screen(1)

The latter each time creates a new Object, which is costly.

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