← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #675958]: How to implement a watchdog timer?

 

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

    Status: Open => Answered

masuo proposed the following answer:
This script run continuously, if main script do not delay.

import thread
duration = 10
#-----count down and type hotkey
def Type_Hotkey(name,*args):
    global duration
    while duration > 0:
        duration = duration - 1
        Do.popup("%d" % duration, "remaining time", 1)
    type(Key.END,Key.CTRL) #type hotkey

#-----hotkey handler
def Exit_Main(event):    
    type(Key.CTRL) #dummy type to cancel CTRL
    exit()

#-----Main script
Env.addHotkey(Key.END, KeyModifier.CTRL, Exit_Main)
thread.start_new_thread(Type_Hotkey,("Type_Hotkey",""))

while True:
    sleep(5)
    duration = 10

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