sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #11146
Re: [Question #200321]: Stop processing key action
Question #200321 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/200321
Status: Open => Answered
RaiMan proposed the following answer:
Someone else already tried that with some Java programs using Sikuli, by
halting the main thread from an observing subthread (I have no idea
whether this is possible on the Sikuli script/Jython level).
It principally worked, but since the task for the observing subtask was
to close a popup window, that came up from time to time, by using a
Sikuli click(), they ran into deadlocks, when the main task was busy
with mouse actions at the moment it was halted.
In general it is possible this way, but you must be aware, that just
halting a Sikuli workflow somewhere in between might lead to
unpredictable results, since after freeing the workflow again, screen
content, window z-order and mouse cursor position might have
substantially changed against the time of interrupt.
Since Sikuli in general is not thread safe, you would have to design
your script like a transaction system with a supervisor process, that
tells the workflow to roll back to the last synch point or even start
all over again.
BTW: currently there is no way for a Sikuli script to recognize, that
any key is pressed by a user, same goes for click actions. Tracking
mouse movement is generally possible (check after a click action, that
the mouse is positioned at the expected location
(Env.getMouseLocation)).
So the final question is: How would you realize, that a user has taken
over?
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.