Jump to content

Exit after 5 min


Recommended Posts

Several ways - easiest one: use AdlibRegister and TimerInit and TimerDiff

Use TimerInit at the beginig of the script and use TimerDiff inside the function called by AdLib - if the value returned by TimerDiff is greater than 1000*60*5 then exit. The function is called automatically every 250ms by default so you don't need to worry.

Have a look at the examples in the help file.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

_Timer_SetTimer() also works nicely, with pretty much just one line of code.

#include <Timers.au3>

$hWnd = GUICreate("", 200, 120)
$hTimer = _Timer_SetTimer($hWnd, 5000, "_Exit", -1)
GUISetState(@SW_SHOW)

;-------------------------------------------------------------------------------
While 1
    If GUIGetMsg() = -3 Then ExitLoop
WEnd
Exit

;-------------------------------------------------------------------------------
Func _Exit($hWnd, $iMsg, $iwParam, $ilParam)
    Beep(800,50)
    Exit
EndFunc
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...