← Back to team overview

sikuli-driver team mailing list archive

[Question #266832]: Mouse clicks in a loop failed

 

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

Hi,

I was writing a loop clicking on a game board which should help to me click 24 buttons, here's the code:

        try:
            gbc=find(Pattern("1431440461493.png").similar(0.35)).getCenter()
            print "Found gameboard"
            for x in range (0,24):
                hover(gbc.offset(xtuple[x],ytuple[x]))
                for m in xrange(2):
                    mouseDown(Button.LEFT)
                    mouseUp(Button.LEFT)
                print "Click: (",xtuple[x],", ",ytuple[x],")"
        except Findfailed:
            print "findgameboardagain"

and the above codes is inside a while loop...
however while i run the code, it can do the clicking sometimes, but just 1~2 loops.
afterward the whole program is stuck in some part of the 24 loops click, sometimes while i press "cmd + tab" and it moves again...
and sometimes it just don't move... in that case i have to stop the script manually.

here's the messages:

Let's find gameboard
Found gameboard

Click: ( -145 , -150 )

Click: ( -68 , -148 )

Click: ( 2 , -144 )

Click: ( 83 , -148 )

Click: ( 156 , -147 )

java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at java.awt.Robot.delay(Robot.java:535)
at java.awt.Robot.autoDelay(Robot.java:521)
at java.awt.Robot.afterEvent(Robot.java:471)
at java.awt.Robot.mouseRelease(Robot.java:315)
at org.sikuli.script.RobotDesktop.mouseUp(RobotDesktop.java:110)
at org.sikuli.script.Mouse.up(Mouse.java:365)
at org.sikuli.script.Mouse.up(Mouse.java:349)
at org.sikuli.script.Mouse.reset(Mouse.java:100)
at org.sikuli.script.Sikulix.cleanUp(Sikulix.java:197)
at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:2252)

i still can't figure out why sometimes it clicks all 24 points, but sometimes just stop without any warnings.

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