← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #231016]: Simple Code - Exception Problem

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
LOL, the wheat/battle problem again.

Someone should tell the guy, who published that, that it is not useable
(to be polite ;-)

He thinks, that with something like

wheat = exists(Pattern("1371649544991.png").similar(0.38))
while wheat:

the check exists(Pattern....) is repeated, when it comes to process .

But it is not the case.
It simply loops forever until the click() crashes or does not try to click at all, if Pattern("1371649544991.png").similar(0.38) was not found before.

If he wants to continuously click while
Pattern("1371649544991.png").similar(0.38) is there, then this is the
right code:

while exists(Pattern("1371649544991.png").similar(0.38)):
    click(Pattern(getLastMatch()) 
    wait(1) # to avoid cpu overload

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