Jump to content
Sign in to follow this  
beb7089

Killing a running script after a given time out

Recommended Posts

beb7089

Currently on my network I have end-users with auto-it compiled exe scripts open and have the file(s) locked making it impossible for me to update these exe. What I would like to do is to include into the script a line of code that would after a given amount of time kill its own process. Say after 3mins and the script is not done, it would simply kill itself and release the file lock.

Any ideas on how I would code this? I know I will need to use ProcessClose and some line of code that basically ticks away the seconds.

Thanks

Share this post


Link to post
Share on other sites
Jos

Something like this will end your script after 3 minutes:

Global $Init_Time = TimerInit()
AdlibEnable("Check_Running_Time")

; your script

Func Check_Running_Time()
 If TimerDiff($Init_Time) > 3 * 60 * 1000 Then Exit
EndFunc
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
beb7089

Something like this will end your script after 3 minutes:

Global $Init_Time = TimerInit()
AdlibEnable("Check_Running_Time")

; your script

Func Check_Running_Time()
 If TimerDiff($Init_Time) > 3 * 60 * 1000 Then Exit
EndFunc
Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.