Stop processing key action

Asked by manas

As we know we can control application via VNC. When i access the application using VNC if someone else using the same application in that machine. I want to stop my further key action until application used by any other person is finished.Is there any way to do with Sikuli?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
manas
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

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?

Revision history for this message
manas (mandalmanas786) said :
#2

I can check , user has taken over when mouse movement is not happening.