← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #682332]: [error] RobotDesktop: checkMousePosition after upgrade to build 325

 

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

Chris Kosieracki gave more information on the question:
I've created a small test script that shows the problem. 
The actual script that I'm have the trouble with does not cause the cursor to fly around as much as this test script, but after doing some debugging I realized that the cursor error problem always occurred when clicking or double clicking something on the screen. That app is using "observe", and the cursor error sometimes occurs in an event and sometimes in the mainline.

import subprocess

Settings.ActionLogs=0
mmd = Settings.MoveMouseDelay
Settings.MoveMouseDelay = 0.2

def image1Event(event):
    print('Event 1')
    if reg.exists(image1,0):
        click(image1)
        print('image1')
        wait(1)
    event.repeat()

def image2Event(event):
    print('Event 2')
    if reg.exists(image2,0):
        click(image2)
        print('image2')
        wait(1)
    event.repeat()

path = '/Applications/Google Chrome.app'
chrome = False
try:
    subprocess.Popen(['open', '-a', path])
    chrome = True
except:
    print "Unexpected error:", sys.exc_info()[0]
    print('Failed to start or set focus to ' + app)

image1 = Pattern("image1.png").similar(0.83)
image2 = Pattern("image2.png").similar(0.90)
tab1 = Pattern("tab1.png").similar(0.79)
tab2 = Pattern("tab2.png").similar(0.79)

urls =
[',https://www.google.com','https://sikulix-2014.readthedocs.io/en/latest/']

tabs = True

if chrome:
    wait(1)
    tReg = Region(0,23,1438,39)
    reg = Region(412,282,631,383)
    if not tabs:
        for url in urls:
            if exists(Pattern("1539898718565.png").similar(0.91),5):
                click()
                paste(url)
                type(Key.ENTER)

    reg.onAppear(image1, image1Event)
    reg.onAppear(image2, image2Event)
    reg.observeInBackground(20)

    for i in range(0,10):
        if tReg.exists(tab1):
            print('tab1')
            click(tab1)
            wait(0.5)
        if tReg.exists(tab2):
            print('tab2')
            click(tab2)
            wait(0.5)

Settings.MoveMouseDelay = mmd

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