Jump to content

Killing a running script after a given time out


beb7089
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...