Jump to content

Recommended Posts

Posted

i wanted to run something every 500 milisecond, and something else every 30 seconds

something like:

AdlibEnable("Status",760)

AdlibEnable("DC",30000)

but it seems like "DC" overtakes "STATUS" .. any good way to make them both run, and at differnt intervals?

Posted

Here is a demo of one of the techniques Zedna is talking about:

Global $iDelay_1 = 1000, $iTimer_1 = TimerInit()
Global $iDelay_2 = 2000, $iTimer_2 = TimerInit()

HotKeySet("{ESC}", "_Quit")
AdlibEnable("_TimerDispatch", 100)

While 1
    Sleep(50)
WEnd

Func _TimerDispatch()
    If TimerDiff($iTimer_1) >= $iDelay_1 Then
        $iTimer_1 = TimerInit()
        ConsoleWrite("Timer_1:  " & $iDelay_1 & "ms" & @LF)
    EndIf
    
    If TimerDiff($iTimer_2) >= $iDelay_2 Then
        $iTimer_2 = TimerInit()
        ConsoleWrite("Timer_2:  " & $iDelay_2 & "ms" & @LF)
    EndIf
EndFunc

Func _Quit()
    Exit
EndFunc

You can only have one AdLib function running, but that one function can be a dispatcher to flag multiple other operations.

_Timer_SetTimer() can create multiple timers, but they must be associated with a GUI that belongs to the script (which can be hidden if no visible GUI is required). See the help file for the example.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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