Jump to content
Sign in to follow this  

how to run two AdlibEnable?

Recommended Posts


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

something like:



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

Share this post

Link to post
Share on other sites

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

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

Func _Quit()

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

Share this post

Link to post
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
Sign in to follow this