danner Posted April 9, 2007 Share Posted April 9, 2007 Ok, the problem is in Line 46, because the error states the WEnd shouldn't be there somehow. What I want is, to loop from the first While to the last, but IF PixelGetColor is any other then the displayed Hex, then ti needs to re-do that loop over and over untill it's back into the origoinal color. Little help anyone? Script: WinWaitActive($Window) While WinExists($Window) While WinActive($Window) Sleep(100) Send("{TAB}") Sleep(100) Send("{SPACE}") Sleep(12000) Send("{SPACE}") Sleep(4000) Send("{SPACE}") Sleep(3000) Send("{SPACE}") Sleep(3000) While 1 If PixelGetColor(117,45) <> 0xE25A54 Then Send("{2}") Sleep(100) Else ExitLoop WEnd WEnd Sleep(200) WEnd Link to comment Share on other sites More sharing options...
Somerset Posted April 9, 2007 Share Posted April 9, 2007 WinWaitActive($Window) While WinExists($Window) While WinActive($Window) Sleep(100) Send("{TAB}") Sleep(100) Send("{SPACE}") Sleep(12000) Send("{SPACE}") Sleep(4000) Send("{SPACE}") Sleep(3000) Send("{SPACE}") Sleep(3000) While 1 If PixelGetColor(117,45) <> 0xE25A54 Then Send("{2}") Sleep(100) Else ExitLoop endif WEnd WEnd Sleep(200) WEnd try Link to comment Share on other sites More sharing options...
danner Posted April 9, 2007 Author Share Posted April 9, 2007 Lol just found out myself while reading that i forgot my endif, thanks Link to comment Share on other sites More sharing options...
danner Posted April 9, 2007 Author Share Posted April 9, 2007 Somehow it didn't work perfectly, so changed it to this: while 1 If PixelGetColor(117,45) <> 0xE25A54 Then Send("2") Sleep(2000) Else Sleep(100) Send("{TAB}") Sleep(100) Send("{SPACE}") Sleep(10000) Send("{SPACE}") Sleep(3500) Send("{SPACE}") Sleep(2500) Send("{SPACE}") Sleep(2500) EndIf WEnd Can't test it just yet, but this SHOULD work right? I mean press 2 when the color is different, and if not do the long loop... Link to comment Share on other sites More sharing options...
Shevilie Posted April 9, 2007 Share Posted April 9, 2007 Yes if the color is not (the color you have choosen) then it sends 2 and wait 2 seconds.. and it will do that until the color is the one you specified... then it will take the long loop (and do that until it changes again) etc etc etc Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Paulie Posted April 9, 2007 Share Posted April 9, 2007 Somehow it didn't work perfectly, so changed it to this: expandcollapse popupwhile 1 If PixelGetColor(117,45) <> 0xE25A54 Then Send("2") Sleep(2000) Else Sleep(100) Send("{TAB}") Sleep(100) Send("{SPACE}") Sleep(10000) Send("{SPACE}") Sleep(3500) Send("{SPACE}") Sleep(2500) Send("{SPACE}") Sleep(2500) EndIf WEndoÝ÷ Ø&§ßÛmzËb¶;¬·'nëm+å +¸ Ò&y©éë,Û^Ø^rh®+÷Þéíjwb~z-vazZ'Z(§ú®¢×rÛ§¢'hmmébz÷«pYp¢¹jËmgrçO¥ëB¢Z+ënçmæÃ"¿Û½©nzíç(Úܨ¹ªÞr©j¸§+m w±¶¼+ºÚ"µÍÚ[HBBRY^[Ù]ÛÛÜLMË JH ÉÝÈXÊLPMM H[Õ]ÚÝ[ÛÜÂBBTÙ[ ][ÝÌ][ÝÊBBBTÛY BBQ[ÙHBBTÛY L BBBTÙ[ ][ÝÞÕPI][ÝÊBBBTÛY L BBBTÙ[ ][ÝÞÔÔPÑ_I][ÝÊBBBTÛY L BBBTÙ[ ][ÝÞÔÔPÑ_I][ÝÊBBBTÛY ÍL BBBTÙ[ ][ÝÞÔÔPÑ_I][ÝÊBBBTÛY L BBBTÙ[ ][ÝÞÔÔPÑ_I][ÝÊBBBTÛY L BBQ[YUÑ[ Link to comment Share on other sites More sharing options...
Shevilie Posted April 9, 2007 Share Posted April 9, 2007 Correct - My sleepness... From docsSuccess: Returns decimal value of pixel's color. Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Helge Posted April 9, 2007 Share Posted April 9, 2007 (edited) $nGUIColor = 0xFF00FF GUICreate("", 10, 10, 0, 0, 0x80000000) GUISetBkColor($nGUIColor) GUISetState() $nGetColor = PixelGetColor(5, 5) MsgBox(64, "", _ "GUI : " & $nGUIColor & @CRLF & _ "GET : " & $nGetColor & @CRLF & @CRLF & _ "Equal : " & ($nGUIColor = $nGetColor)) Edited April 9, 2007 by Helge Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 9, 2007 Share Posted April 9, 2007 Actually, no i don't believe that will work. Last time I checked, PixelGetColor retured the DECIMAL value of the color. and you are comparing it to Hex You don't actually have to worry about that in this situation. Number formatting is significant when humans are typing, reading, or printing numbers, not in programs comparing them. Demo: $Hex = 0x10 $Dec = 16 If $Dec = 0x10 And $Hex = 16 Then MsgBox(64, "Match", "Match") Else MsgBox(16, "No Match", "No Match") EndIf 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 Link to comment Share on other sites More sharing options...
therks Posted April 9, 2007 Share Posted April 9, 2007 Just in case Psalty's post was a bit vague, I just wanted to specifically and conspicuously point out that when you prefix a number with 0x and it's not inside a string, it evaluates that number as a decimal number.So in Psalty's example above, both $Hex and $Dec are equal to eachother. 0x10 = 16, just like 0xF = 15, 0xFF = 255, etc.Just try: MsgBox(0, 'Hex', 0xBEEFED); And you should get 12513261.Remember not to wrap in quotes though. Cus MsgBox(0, 'Hex', '0xBEEFED') will just print 0xBEEFED.Dec(0xE25A54) is functionally equivalent to Dec(14834260) (Which is obviously redundant ) My AutoIt Stuff | My Github 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