← 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

    Status: Open => Answered

RaiMan proposed the following answer:
Clicking in threads does not make sense, because screen, mouse and
keyboard are singleton resources, whose usage must be synchronized. (the
reason why you usually cannot do anything on the machine, while a script
is running)

The normal scripted workflow takes care for that, because the actions
are done one after the other.

An exception is the asynchronous observe feature, where you have to take
care, that actions in the handler do not clash with actions in the main
workflow.

The Mouse feature as such at least internally takes care, that a click
(move, down, up) is completed, before the next Mouse action can be
started.

Anyways I do not see any sense in using threading for click actions,
since it cannot be foreseen, which thread comes first.

... so what about that?
x = [loc1, loc2, loc3, loc1, loc2, loc3, loc1, loc2, loc3]

---------------- (I would also one day like to have exists() working ....
see findBest() / findAny(), that searches threaded in parallel:
https://sikulix-2014.readthedocs.io/en/latest/region.html#find-more-than-one-image-in-a-region-at-the-same-time

for loc in x:
    click(loc)

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