Jump to content

Timed stopping of the script


jgus
 Share

Recommended Posts

Is their a way that the script can be told to just give up(quit) if a certain amount of time goes by? I would just like to make sure the script doesn't hang up on the users PC with a splash screen and then the user will have to call us to kill the script. It would be nice if the script could know to kill itself if it is taking too long.

Link to comment
Share on other sites

Timeouts are in most winwait related functions and messageboxes, so they will allow the script to continue. The script may fail it's objective but it may finish. depending on the way that you code it. You can add more if..else..endif and so on, with may make your script a safer script.

Link to comment
Share on other sites

Also as a quick reply... check the help file for TimerInit() and TimerDiff().

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Also you can use a global timer with adlib.

Set adlib to quit after a certain TimerDiff

You can reset the timer as you go along as well.

ex:

adlibenable("myadlib")
$begin = TimerInit()

MsgBox(1,"Info","you have 3 sec to continue")
$begin = TimerInit(); reset timer

while 1
tooltip(int(TimerDiff($begin)/1000),0,0)
sleep(10); stuck
wend

Func myadlib()
If TimerDiff($begin)>3000 Then 
    MsgBox(0,"Error","Time limit exceded!")
    exit
EndIf
endfunc

AutoIt3, the MACGYVER Pocket Knife for computers.

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...