The purpose of the script below is to check a particular application's idle
time. If it exceeds a predetermined amount of time, the application is closed
and started again. My fear is whether this script will end up in infinite loop.
I have made remarks within the script where I have concern
*** Start code
static lapsed, count
local handle
handle= win.handle("=xplorer2_UC")
win.debug("handle:*" ++ handle ++ "*" )
if (handle == "") do
if (event.exists(event_handle))
event_handle=event.destroy(event_handle)
quit
endif
if (handle == win.handle("active")) do
count =0
else
count = count + 1
endif
win.debug("count:" ++ count)
if (count > lapsed ) do
win.close(handle)
if (event.exists(event_handle))
event_handle=event.destroy(event_handle)
; PLEASE NOTE NEXT TWO LINES
; I AM STARTING THE APPLICATION AND
; CALLING SUBROUTINE WITHIN THIS SCRIPT
; WHAT WILL HAPPEN IF THE OPENED APPLICATION IS NOT
; TOUCHED FOR 8 HOURS
; I HAVE KEPT THE TIME INTERVAL VERY LOW FOR
; TESTING PURPOSES
do("C:\Program Files\~~File Managers\xplorer2\xplorer2_UC.exe")
.t...@initiate
endif
Quit
@Initiate
static count = 0
static lapsed = 5
static event_handle = event.create(3,0,".test")
*** End Code
Thanks
Peter