← 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 is a way to use hotkey handler.

import thread
#-----count down and type hotkey
def Type_Hotkey(name,*args):
    cnt = args[0]
    while cnt > 0:
        cnt = cnt - 1
        sleep(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)
duration = 5
thread.start_new_thread(Type_Hotkey,("Type_Hotkey",duration))
while True:
    sleep(1)

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