Flamaros Posted April 22, 2007 Share Posted April 22, 2007 I need to be able to use send command for many keys at periodict time, but it's not the same time for all keys. For exemple I need to press "a" every 250 ms and "b" every 320 ms,... I had try to use AdlibEnable function but it works only for the lastest call of it. I think that I can use a callback called each second and use the mod function to solve the probleme but it's a curious way for me. Maybe there is an other solution? Link to comment Share on other sites More sharing options...
sandman Posted April 22, 2007 Share Posted April 22, 2007 (edited) You can just use this: Func a() ;do stuff Sleep(250) EndFunc Func b() ;do stuff Sleep(320) EndFunc Func c() a() b() EndFunc c() I am not sure if that was not what you were looking for, but.. there it is! Edited April 22, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center] Link to comment Share on other sites More sharing options...
Uten Posted April 22, 2007 Share Posted April 22, 2007 @sandman how do you tink that will play out on the timelin? I would sugest something like this: expandcollapse popup;TimerLib.au3 ; #region - Timer Global $TimerStorage[10][3] Global $TimerGo = 0 Func TimerAdd($funcname, $ms) dbg("TimerAdd($funcname:=" & $funcname & ", $ms:=" & $ms) $ret = $TimerStorage[0][0] + 1 $TimerStorage[$ret][0] = $funcname $TimerStorage[$ret][1] = $ms $TimerStorage[$ret][2] = 0 $TimerStorage[0][0] = $ret Return $ret EndFunc Func TimerRemove($id) $TimerStorage[$id][0] = "" $TimerStorage[$id][1] = "" $TimerStorage[$id][2] = 0 EndFunc Func TimerCheck() ;;;dbg("TimerCheck::$TimerGo:=" & $TimerGo) For $i = 1 to $TimerStorage[0][0] If $TimerStorage[$i][0] <> "" Then If $TimerStorage[$i][2] = 0 Then $TimerStorage[$i][2] = TimerInit() ElseIf TimerDiff($TimerStorage[$i][2]) >= $TimerStorage[$i][1] Then ;;;dbg("Calling: " & $TimerStorage[$i][0]) Call($TimerStorage[$i][0]) $TimerStorage[$i][2] = TimerInit() EndIf EndIf Next EndFunc #endregion - Timer Func Main() HotKeySet("{ESC}", "Terminate") TimerAdd("A", 1000) TimerAdd("B", 300) TimerAdd("C", 33) AdLibEnable("TimerCheck", 25) While True sleep(10) WEnd Exit EndFunc Func Terminate() Exit EndFunc Func A() dbg("A Called") EndFunc Func B() dbg("B Called") EndFunc Func C() dbg("C Called") EndFunc Func dbg($msg, $line=@ScriptLineNumber, $err=@error, $ext=@extended) ConsoleWrite("(" & $line & ") := (" & $err & ")(" & $ext & ") " & $msg & @CRLF) EndFunc ; ==================== Main() Exit Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
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