kw_rock Posted May 3, 2006 Share Posted May 3, 2006 Ok, I'm having trouble with this concept.. It's a basic idea, but I think has too indepth of a way to make it work. Say I want to insert the letter A, B, and C. But I want to insert A every 3 seconds, B every 5 seconds, and C every 8 seconds... How do I create a little snippet that would allow that? Because you can't use more than 1 While....WEnd command back to back? I've tried a few different ways, but nothing works for me. Please help! It's not a difficult idea and shouldn't require more than 10 lines to do, so please help. Link to comment Share on other sites More sharing options...
Valuater Posted May 3, 2006 Share Posted May 3, 2006 maybe $begin1 = TimerInit() $begin2 = TimerInit() $begin3 = TimerInit() While 1 $dif1 = TimerDiff($begin1) If $dif1 >= 3000 Then MsgBox(0, "Time Difference 1", $dif1, 1) ; Send("A") $begin1 = TimerInit() EndIf $dif2 = TimerDiff($begin2) If $dif2 >= 5000 Then MsgBox(0, "Time Difference 2", $dif2, 1) ; Send("B") $begin2 = TimerInit() EndIf $dif3 = TimerDiff($begin3) If $dif3 >= 8000 Then MsgBox(0, "Time Difference 3", $dif3, 1) ; Send("C") $begin3 = TimerInit() EndIf WEnd just remove the message boxes and the semi-colins 8) Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 3, 2006 Share Posted May 3, 2006 Hi, nice Valuater. Maybe my easy solution works as well HotKeySet("{esc}", "end") Dim $i = 0 While 1 Sleep(1000) $i += 1 Select Case $i = 3 Send("A") case $i = 5 Send("B") case $i = 8 Send("C") $i = 0 EndSelect WEnd Func end() Exit(0) EndFunc So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Valuater Posted May 3, 2006 Share Posted May 3, 2006 (edited) Hi, nice Valuater. Maybe my easy solution works as well HotKeySet("{esc}", "end") Dim $i = 0 While 1 Sleep(1000) $i += 1 Select Case $i = 3 Send("A") case $i = 5 Send("B") case $i = 8 Send("C") $i = 0 EndSelect WEnd Func end() Exit(0) EndFunc So long, Mega you need more than one variable to keep the timing correct 8) Edited May 3, 2006 by Valuater Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 3, 2006 Share Posted May 3, 2006 (edited) HI, after C was sent. --> in the 3rd case statement. yes, it won't be that correct, but it is easy to understand and I didn't know whether he / she needs that exact time. So long, Mega Edited May 3, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Valuater Posted May 3, 2006 Share Posted May 3, 2006 HI,after C was sent. --> in the 3rd case statement.So long,Megalook again... its not going to work at 6 seconds or 10 seconds... etc6 seconds is the 2nd "A"... and 10 seconds is the 2nd "B"... etc8) Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 3, 2006 Share Posted May 3, 2006 (edited) look again... its not going to work at 6 seconds or 10 seconds... etc6 seconds is the 2nd "A"... and 10 seconds is the 2nd "B"... etc8)Okay okay, you won. It was just a quick and dirty soultion. So long,Mega Edited May 3, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Valuater Posted May 3, 2006 Share Posted May 3, 2006 (edited) Okay okay, you won. It was just a quick and dirty soultion. So long,Megayou know... now that i think about iti answered his question... as he asked it... butI think YOU answered what he/she really wanted ( and he just didn't explain it very good )lol...oh-well8)BTWi liked your mili-second script... i put it in the autoit wrappers thread Edited May 3, 2006 by Valuater Link to comment Share on other sites More sharing options...
jvanegmond Posted May 3, 2006 Share Posted May 3, 2006 Hi, nice Valuater. Maybe my easy solution works as well HotKeySet("{esc}", "end") Dim $i = 0 While 1 Sleep(1000) $i += 1 Select Case $i = 3 Send("A") case $i = 5 Send("B") case $i = 8 Send("C") $i = 0 EndSelect WEnd Func end() Exit(0) EndFunc So long, Mega In stead of using $i = 3 you should use MathCheckDivide or write your own. In that case it will work, and you shouldn't reset I anywhere. github.com/jvanegmond Link to comment Share on other sites More sharing options...
kw_rock Posted May 4, 2006 Author Share Posted May 4, 2006 (edited) I felt I was descriptive enough... All I said was, every 3 seconds A needs to be send, every 6 B needs to be sent and every 8 C needs to be sent. They have to go off at exact times, and have to loop... Not just do it once.. but send A like infinity times.. lol Edited May 4, 2006 by kw_rock Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 4, 2006 Moderators Share Posted May 4, 2006 I felt I was descriptive enough...All I said was, every 3 seconds A needs to be send, every 6 B needs to be sent and every 8 C needs to be sent.They have to go off at exact times, and have to loop... Not just do it once.. but send A like infinity times.. lolValuater gave you what you asked for specifically... Did it work? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
kw_rock Posted May 4, 2006 Author Share Posted May 4, 2006 YEAH! It worked perfectly, and it kinda helped me add more functions and such... Thanks! It worked great. Link to comment Share on other sites More sharing options...
Valuater Posted May 4, 2006 Share Posted May 4, 2006 YEAH! It worked perfectly, and it kinda helped me add more functions and such... Thanks! It worked great. Welcome8) 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