← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #678649]: How do I use Multi Thread Clicking?

 

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

Description changed to:
I'm trying to do basic multi threaded clicking in sikuli (I would also
one day like to have exists() working in a similar multi threaded way).
This is my simple example code:

import threading

loc1 = Location(117, 803); loc2 = Location(499, 777); loc3 = Location(1211, 754)
x = [loc1, loc2, loc3, loc1, loc2, loc3, loc1, loc2, loc3]

def worker(location):
    click(location)

threads = []
for i in x:
    t = threading.Thread(target=worker, args=(i,))
    threads.append(t)
    t.start()

when I run the code it almost looks like it works. the mouse teleports
around to the right locations but sometimes it doesn't actually click
even though the log reports clicks. And then I get errors like:

[error] RobotDesktop: checkMousePosition: should be L[1211,754]@S(0)
but after move is L[117,802]@S(0)
Possible cause in case you did not touch the mouse while script was running:
Mouse actions are blocked generally or by the frontmost application.
[error] RobotDesktop: checkMousePosition: should be L[1211,754]@S(0)
but after move is L[499,777]@S(0)
Possible cause in case you did not touch the mouse while script was running:
Mouse actions are blocked generally or by the frontmost application.
[log] CLICK on L[117,803]@S(0) (657 msec)
[log] CLICK on L[499,777]@S(0) (651 msec)
[log] CLICK on L[499,777]@S(0) (653 msec)
[log] CLICK on L[1211,754]@S(0) (717 msec)
[log] CLICK on L[117,803]@S(0) (725 msec)
[log] CLICK on L[117,803]@S(0) (728 msec)
[log] CLICK on L[1211,754]@S(0) (725 msec)
[log] CLICK on L[1211,754]@S(0) (765 msec)
[log] CLICK on L[499,777]@S(0) (768 msec)

how do I make this so that it works properly so that I can click
multiple things at once (or in very rapid succession?)

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