Jump to content

How to close AutoIT script automatically after it hangs for 1 hour?


Recommended Posts

Hi,

I currently have a AutoIT script that installs a Firefox plugin. Sometimes my AutoIT script hangs, due to bad builds of the Firefox plugin.

Because I have the entire process automated, and it runs overnight. Sometimes, the AutoIT script will hang all night until I notice it in the morning.

I was wondering if there was any possible way to have the AutoIT script just close itself out after a certain period of time?

Thanks.

Link to comment
Share on other sites

Hi there,

Try AdlibRegister.

Cheers and welcome aboard

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

  • Moderators

In addition to what November pointed out, how about posting your script along with where it hangs? Depending on the nature of the hang (simple wait vs. hard stop), how you handle it will vary.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Does it hang because it crashes from some error, or does the execution take too long, or something else?

If execution is too long, then adlib...() will work.  If your script blows up, it won't.

There are additional levels of abstraction, but I'd execute the script via another script, and if the process takes longer than X amount of time, kill the process.

This works for if the script is stuck in some loop, or if the script blows up during execution:

$iTimer = TimerInit()
$iMax = 1000*60*60 ; 1 hour
$iPID = Run("YourCompiledAU3.exe /ErrorStdOut your paramms go here")
While ProcessExists($iPID) And TimerDiff($iTimer) < $iMax
    Sleep(20000)
WEnd

If ProcessExists($iPID) Then
    ProcessClose($iPID)
    Exit 1
Else
    Exit 0
EndIf
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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...