sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #52164
Re: [Question #682123]: Monitor whether a script is running but frozen for a while
Question #682123 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/682123
Status: Open => Answered
masuo proposed the following answer:
There is a way to use thread module.
This script will exit after 10 seconds.
[example]
#-----count down and type hotkey
def Type_Hotkey(name,*args):
cnt = args[0]
while cnt > 0:
cnt = cnt - 1
Do.popup("%d" % cnt, "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
import thread
duration = 10
Env.addHotkey(Key.END, KeyModifier.CTRL, Exit_Main)
thread.start_new_thread(Type_Hotkey,("Type_Hotkey",duration))
while True:
sleep(5)
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.