DNnlee Posted February 24, 2009 Posted February 24, 2009 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?
Zedna Posted February 24, 2009 Posted February 24, 2009 (edited) TimerInit() TimerDiff() or SetTimer API Edited February 24, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
PsaltyDS Posted February 24, 2009 Posted February 24, 2009 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now