Jmjl Posted July 3, 2006 Share Posted July 3, 2006 Ok, I know this sounds kind of n00bish but I can seem to figure something out invovling If statements. I've looked in the help and it didn't help . I understand the concept and I know how it works (I program in VB) only I can't seem to figure this out. What I want to do is constantly be checking the pixel colour in a specific pixel and if the pixel colour equals a certain hex value say red FF0000 then to click on that location only I can't figure it out. Thanks for the help! Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 3, 2006 Share Posted July 3, 2006 (edited) Hi, did you try it, already? Show your script, please. So long, Mega Edited July 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...
ending Posted July 3, 2006 Share Posted July 3, 2006 (edited) Does it look something like this? While 1 = 1 $pixel = PixelGetColor(10,100);or whereever your location is If Hex($pixel) = FF0000 Then ;do stuff here if it is red ;Else ;could do an else, but its not required EndIf WEnd If so, you're on the right track. Edited July 3, 2006 by ending Link to comment Share on other sites More sharing options...
Jmjl Posted July 3, 2006 Author Share Posted July 3, 2006 (edited) Yeah, that is pretty much exactly what my code is except I didn't have the If Hex($pixel) = FF0000 ThenI didn't have the hex part. Does that really matter? Either way when I run your code I still get the error:Any solutions? Edited July 3, 2006 by Jmjl Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 3, 2006 Share Posted July 3, 2006 (edited) Hi,what about showing your try? Maybe this helps out 'FF0000'So long,Mega Edited July 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...
PsaltyDS Posted July 3, 2006 Share Posted July 3, 2006 Yeah, that is pretty much exactly what my code is except I didn't have the If Hex($pixel) = FF0000 Then I didn't have the hex part. Does that really matter? Either way when I run your code I still get the error: Any solutions? Your use of the hex number is wrong. For hex you need 0x prefix. Try: $Color = 0xFF0000 ; edit for color (RGB hex) $x = 200 ; edit for x pos $y = 200 ; edit for y pos While 1 If PixelGetColor($x,$y) = $Color Then ;do stuff here if it is red MouseClick($x, $y) ;Else ;could do an else, but its not required EndIf WEnd 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...
Jmjl Posted July 3, 2006 Author Share Posted July 3, 2006 THANKS! It worked. I truly appreciate it! This is just a side quesiton and not really important but it would be nice to have, is there a way to check a range of pixels? i.e. 30, 200 to 50, 300 or something like that? Link to comment Share on other sites More sharing options...
Josbe Posted July 3, 2006 Share Posted July 3, 2006 THANKS! It worked. I truly appreciate it!This is just a side quesiton and not really important but it would be nice to have, is there a way to check a range of pixels? i.e. 30, 200 to 50, 300 or something like that?Maybe something like PixelChecksum? AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
marfdaman Posted July 3, 2006 Share Posted July 3, 2006 Or perhaps For $x = 30 To 50 For $y = 200 To 300 If PixelGetColor($x, $y) = 0xFF0000 Then MsgBox(0, "", "Pixel found at :" & $x & ", " & $y) Next Next Alzo... Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 4, 2006 Share Posted July 4, 2006 (edited) THANKS! It worked. I truly appreciate it! This is just a side quesiton and not really important but it would be nice to have, is there a way to check a range of pixels? i.e. 30, 200 to 50, 300 or something like that? Check out the PixelSearch() function, which searches a defined rectangle for a color: $Color = 0xFF0000 $XYResult = PixelSearch(30, 200, 50, 300, $Color) If @error Then MsgBox(16, "Failed", "Color " & $Color & " not found.") Else MsgBox(64, "Success", "Found color " & $Color & " at x=" & $XYResult[0] & ", y=" & $XYResult[1]) EndIf Edit: Tweak... thanks Daniel W. Edited July 4, 2006 by PsaltyDS 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...
Daniel W. Posted July 4, 2006 Share Posted July 4, 2006 Check out the PixelSearch() function, which searches a defined rectangle for a color: $Color = 0xFF0000 $XYResult = PixelSearch(30, 200, 50, 300, $Color If @error Then MsgBox(16, "Failed", "Color " & $Color & " not found.") Else MsgBox(64, "Success", "Found color " & $Color & " at x=" & $XYResult[0] & ", y=" & $XYResult[1]) EndIfoÝ÷ Ûú®¢×ºÚ"µÍÌÍÐÛÛÜHÌÍÖTÝ[H^[ÙXÚ Ì LÌ ÌÍÐÛÛÜ BYÜ[ÙÐÞ M ][ÝÑZ[Y ][ÝË ][ÝÐÛÛÜ ][ÝÈ [È ÌÍÐÛÛÜ [È ][ÝÈÝÝ[][ÝÊB[ÙBÙÐÞ ][ÝÔÝXØÙÜÉ][ÝË ][ÝÑÝ[ÛÛÜ ][ÝÈ [È ÌÍÐÛÛÜ [È ][ÝÈ]I][ÝÈ [È ÌÍÖTÝ[ÌH [È ][ÝËOI][ÝÈ [È ÌÍÖTÝ[ÌWJB[Y You missed the ")" after $Color --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
Jmjl Posted July 4, 2006 Author Share Posted July 4, 2006 Works great, thanks guys! 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