← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #497368]: Conditional no-user-activity trigger

 

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

    Status: Answered => Open

Hatim is still having a problem:
OK great. I'll try it out.
Thanks a lot

On Thu, Mar 2, 2017 at 1:19 AM, RaiMan <question497368@xxxxxxxxxxxxxxxxxxxxx
> wrote:

> Your question #497368 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/497368
>
>     Status: Open => Answered
>
> RaiMan proposed the following answer:
> Since everything with SikuliX is visual, it depends, how you are able to
> visually track activity/inactivity.
>
> Another option might be, to continually track the mouse position and do
> your job, if the mouse is no longer moved for some time.
>
> lastPos = Mouse.at()
> lastMove = time.time()
> maxWait = 15 #seconds
> saved = False
> while True:
>     wait(1)
>     currentPos = Mouse.at()
>     if lastPos.x == currentPos.x and  lastPos.y == currentPos.y:
>         if lastMove + maxWait < time.time and not saved:
>             #here you should do your actions
>             saved = True
>     else:
>         lastMove = time.time()
>         lastPos = currentPos
>
> ... you might add something, to make this endless loop interruptible -
> otherwise you have to kill it.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/497368/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/497368
>
> You received this question notification because you asked the question.
>

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