sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #42410
Re: [Question #631226]: set time duration to run script
Question #631226 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/631226
Status: Open => Answered
masuo proposed the following answer:
This is sample codes for self countdown timer.
[sample code:]
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
sys.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.