← 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: Answered => Open

matteoa is still having a problem:
Hello Masuo,
thanks a lot for helping.
I tried to copy and paste your script directly in the 1.1.4 ide and run from there.
It closes the ide, and the java process that's running it.
I was expecting that the Ide wouldn't be closed
What I did wrong?
Thanks in advance
Matteo
I added some debug to understand better:
import thread
b=getBundleFolder()
Debug.setUserLogFile(b + "DebugSikuliX.log") 
Debug.user('getBundleFolder='+ b)    

#-----count down and type hotkey
def Type_Hotkey(name,*args):
    Debug.user('Type_Hotkey='+ name)    
    cnt = args[0]
    while cnt > 0:
        cnt = cnt - 1
        sleep(1)
    type(Key.END,Key.CTRL) #type hotkey

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

#-----Main script
Debug.user('Start')  
Env.addHotkey(Key.END, KeyModifier.CTRL, Exit_Main)
duration = 5
thread.start_new_thread(Type_Hotkey,("Type_Hotkey",duration))
Debug.user('start_new_thread')  
while True:
    sleep(1)
Debug.user('Stop')  


And this is the content of the corresponding debug file:
[user (06/11/18 11.23.35)] getBundleFolder=C:\TEst\sikulix\watchdogExample.sikuli\
[user (06/11/18 11.23.35)] Start
[user (06/11/18 11.23.35)] start_new_thread
[user (06/11/18 11.23.35)] Type_Hotkey=Type_Hotkey
[user (06/11/18 11.23.40)] Exit_Main

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