Jump to content

Recommended Posts

Posted

Hi

How can I stop / exit my script after 5 min? Would like the rest of the script to run stuff during the 5 min though.

But needs to exit when 5 min is reached.

Would appreciate any help :mellow:

Posted

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 :)

Posted

Hi

How can I stop / exit my script after 5 min? Would like the rest of the script to run stuff during the 5 min though.

But needs to exit when 5 min is reached.

Would appreciate any help :mellow:

Thanks :)

Posted

_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
Posted

Will the adlib function run even if there's a script blocking function running, such as a msgbox?

Or is it only effective in the case of loops running?

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
  • Recently Browsing   0 members

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