tweaker Posted January 30, 2007 Share Posted January 30, 2007 I'm having problems with this time variable loop. The time on my clock is set to Tuesday 8:35am. When I run this only the $divider3 shows up. Why won't the other 2 show up? What I'm trying to do is up until Tuesday at 2:10pm do $divider1, Tuesday at 8:10pm do $divider2 and Tuesday 8:40pm do $divider3. There's no error given or anything, it just doesn't look at the other time variables. Any assistance would be greatly appreciated. Here's my code: ; AutoIt timewatcher.au3 $divider1 = "===================" $divider2 = "************************" $divider3 = "oooooooooooooooooooooooo" $LOOP = 30 ; infinite loop While 1 If @WDAY = 3 And @HOUR < 14 And @MIN < 10 Then Send ($divider1 & "{ENTER}") If @WDAY = 3 And @HOUR < 20 And @MIN < 10 Then Send ($divider2 & "{ENTER}") If @WDAY = 3 And @HOUR < 20 And @MIN < 40 Then Send ($divider3 & "{ENTER}") Sleep($LOOP * 1000) WEnd Link to comment Share on other sites More sharing options...
Uten Posted January 30, 2007 Share Posted January 30, 2007 (edited) Uhh, Send where Don't you use your computer at all on Tuesdays? Rather than using send you should debug with FileWrite, ConsoleWrite or something similar until you have verified that your code works as expected. My guess is that you send your stuff to a window that don't accept it. EDIT: Typo. Edited January 30, 2007 by Uten 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...
tweaker Posted January 30, 2007 Author Share Posted January 30, 2007 I've added a MouseClick to the code but again, only the 3rd variable prints. Wouldn't it stand to reason that if the 3rd variable prints then the 1st and 2nd would too since they're sending the text to the same region? I'm trying to program a chat program. I only gave tuesday because that's as far as I've gotten so far. I figure if I can program Tuesday's correctly then the other day's will fall right into place since it would be the same code only a different @WDAY. The 3rd If @WDAY statement is the only one that shows up. The beginning text shows up perfectly (Where is says "Prebot Initializing" and "Prebot Initialized"). I only did that to make sure that it worked, which it does. So what doesn't the first and second @WDAY = 3 strings show up? expandcollapse popup; AutoIt PreBeta.au3 ; Declare Variables $mtgopre = "Additional information can be found at http://www.mtgopre.com" $mtgoprekarma = "Additional information can be found at http://www.mtgopre.com/karma" $starttime30 = "Start time is approximately 30 minutes after signup." $starttime60 = "Start time is approximately 60 minutes after signup." $divider = "==================================================" ; Declare Tuesday PRE's $twoheadedtuesday1 = "Two Headed Tuesday begins at 2:00pm EST. /join THT" $twoheadedtuesday2 = "Registration begins at 1:00pm EST" $twoheadedtuesday3 = "Two Headed Tuesday is sponsored by Cardhoarder" $tribalwars1 = "Tribal Wars begins at 8:00pm EST. /join tribal" $tribalwars2 = "Registration begins at 7:00pm EST" $tuesdaypdc1 = "Two Headed PDC begins at 8:30pm EST. /join tpdc" ; wait for pixel 208,211's color is 8409136 While (PixelGetColor(208,211) <> 8409136) sleep( 2000 ) WEnd ; click background MouseClick("left",130,130,1) sleep( 200 ) send("/join prebeta") send("{ENTER}") ; wait for pixel 164,370's color is 9802661 While (PixelGetColor(164,370) <> 9802661) sleep( 200 ) WEnd ; send opening announcement MouseClick("left",164,370,1) send("PreBot Initializing, Please Wait...") send("{ENTER}") sleep( 1000 ) send("PreBot Initialized") send("{ENTER}") $LOOP = 30 ; infinite loop While 1 MouseClick("left",164,370,1) ; Program Sunday Events ; Program Monday Events ; Program Tuesday Events ; THT If @WDAY = 3 AND @HOUR < 14 And @MIN < 10 Then Send($divider & "{ENTER}" & $twoheadedtuesday1 & "{ENTER}" & $twoheadedtuesday2 & "{ENTER}" & $twoheadedtuesday3 & "{ENTER}" & $mtgopre & "{ENTER}" & $divider & "{ENTER}") ; TW If @WDAY = 3 AND @HOUR < 20 And @MIN < 10 Then Send($divider & "{ENTER}" & $tribalwars1 & "{ENTER}" & $tribalwars2 & "{ENTER}" & $mtgopre & "{ENTER}" & $divider & "{ENTER}") ; TPDC If @WDAY = 3 AND @HOUR < 20 And @MIN < 40 Then Send($divider & "{ENTER}" & $tuesdaypdc1 & "{ENTER}" & $starttime30 & "{ENTER}" & $mtgopre & "{ENTER}" & $divider & "{ENTER}") ; Program Wednesday Events ; Program Thursday Events ; Program Friday Events ; Program Saturday Events ; no need to hurry to re-check the time Sleep($LOOP * 2000) WEnd Uhh, Send where Don't you use your computer at all on Tuesdays? Rather than using send you should debug with FileWrite, ConsoleWrite or something similar until you have verified that your code works as expected. My guess is that you send your stuff to a window that don't accept it. EDIT: Typo. Link to comment Share on other sites More sharing options...
BigDod Posted January 30, 2007 Share Posted January 30, 2007 Could it be that @Min is greater than 10. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
tweaker Posted January 30, 2007 Author Share Posted January 30, 2007 (edited) OK, I must not understand something here.> 10, > 10 and < 40 still only has the 3rd line showing up.Where am I missing the logic in this? Does the last time stamp have to be the opposite of what I want? On the 3rd time frame I want it to stop and do nothing until the next @WDAY.TweakerCould it be that @Min is greater than 10. Edited January 30, 2007 by tweaker Link to comment Share on other sites More sharing options...
Uten Posted January 30, 2007 Share Posted January 30, 2007 It is probably the receiver of your Send(...), as i predicted in the previous post. Try this: testTimeLoop() Exit Func testTimeLoop() ;AutoIt timewatcher.au3 Local $day = @WDAY, $hour = @HOUR+1, $min=@MIN+1 $divider1 = "===================" $divider2 = "************************" $divider3 = "oooooooooooooooooooooooo" Run("notepad.exe") WinWait("Untitled") $LOOP = 30 dbg2($day & ":" & $hour & ":" & $min & "{ENTER}") ; infinite loop Do If (@WDAY = $day ) And (@HOUR < $hour) And (@MIN = $min) Then dbg2 ($divider1 & "{ENTER}") If (@WDAY = $day ) And (@HOUR < $hour) And (@MIN < $min) Then dbg2 ($divider2 & "{ENTER}") If @WDAY = $day And @HOUR < $hour And @MIN < ($min+1) Then dbg2 ($divider3 & "{ENTER}") Sleep($LOOP * 1000) dbg2(@WDAY & ":" & @HOUR & ":" & @MIN & "{ENTER}") Until @min = $min + 2 EndFunc Func dbg2($msg) Send($msg) EndFunc 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