LibertyMan Posted September 22, 2010 Posted September 22, 2010 (edited) I must be doing wrong, help me please... It's not finding the color and running tooltip() The Color is there & the color is already in hex form... expandcollapse popup;Pre-Set Colors! ---> Start Global $Green = "30E730" , $Yellow = "CACA2E" , $Purple = "D21CD2" , $White = "F7F7F7" , $Blue = "2289E2" , $Orange = "F69535" , $Red = "FE6161" ;End Pre-Set Colors --> End $x = 315 $y = 217 For $y2 = 192 to $y ; 286 ; The Start For $x2 = 285 to $x ; 193 ; The End $test = PixelGetColor ($x2,$y2) If Hex($test,6) = $Green Or $Yellow Or $Purple Or $White Or $Blue Or $Orange Or $Red Then Case $test = $Yellow ToolTip("Yellow") Sleep(3000) _WriteLog() Case $test = $Purple ToolTip("Purple") Sleep(3000) Case $test = $White ToolTip("White") Sleep(3000) Case $test = $Blue ToolTip("Blue") Sleep(3000) Case $test = $Orange ToolTip("Orange") Sleep(3000) Case $test = $Red ToolTip("Red") Sleep(3000) Case Else ToolTip("Cant Find Matching Color YET!") ;Sleep(4000) EndSelect EndIf Next Next Edited September 22, 2010 by LibertyMan
maqleod Posted September 22, 2010 Posted September 22, 2010 It might work a bit better if you complete those for loops. [u]You can download my projects at:[/u] Pulsar Software
LibertyMan Posted September 22, 2010 Author Posted September 22, 2010 (edited) NextNext should be at end...My problem is not that, updatedfirst post so peoples may know.My problem is detecting the color...It's pulling the hex numbers, but not saying the color n text.Edited: Thought maybe I wrote the case wrong or something?...Case Hex($test,6) = hex(0X30E730,6) Tooltip("GREEN") Sleep(3000) and even Case $test = 30E730 Tooltip("GREEN") Sleep(3000) Edited September 22, 2010 by LibertyMan
maqleod Posted September 22, 2010 Posted September 22, 2010 Have you verified with a MsgBox that the Hex command is returning what you think it is returning? And why do you need both the If structure and the select structure? [u]You can download my projects at:[/u] Pulsar Software
LibertyMan Posted September 22, 2010 Author Posted September 22, 2010 Heh,.. forgot to add hex On $test Updating first post and changing to solved. Thank you.. Case $test = $Yellow ToolTip("Yellow") Sleep(3000) _WriteLog() Case $test = $Purple ToolTip("Purple") Sleep(3000) Case $test = $White ToolTip("White") Sleep(3000) Case $test = $Blue ToolTip("Blue") Sleep(3000) Case $test = $Orange ToolTip("Orange") Sleep(3000) Case $test = $Red ToolTip("Red") Sleep(3000) Case Else ToolTip("Cant Find Matching Color YET!") ;Sleep(4000) EndSelect EndIf Next Next
smashly Posted September 22, 2010 Posted September 22, 2010 Hi,#Include <Misc.au3> ;Pre-Set Colors! ---> Start Global $Green = 0x30E730 , $Yellow = 0xCACA2E , $Purple = 0xD21CD2 , $White = 0xF7F7F7 , $Blue = 0x2289E2 , $Orange = 0xF69535 , $Red = 0xFE6161 While Not _IsPressed("1B") ; Esc to exit Sleep(10) $aMGP = MouseGetPos() $Color = Hex(PixelGetColor($aMGP[0],$aMGP[1]), 6) Switch $Color Case Hex($Green, 6) ToolTip("Green") Case Hex($Yellow, 6) ToolTip("Yellow") Case Hex($Purple, 6) ToolTip("Purple") Case Hex($White, 6) ToolTip("White") Case Hex($Blue, 6) ToolTip("Blue") Case Hex($Orange, 6) ToolTip("Orange") Case Hex($Red, 6) ToolTip("Red") Case Else ToolTip("Cant Find Matching Color YET!" & @LF & "Current Color: " & $Color) EndSwitch WEndNot sure if it's correct way of comparing the colors, but give it a shot. Cheers
LibertyMan Posted September 23, 2010 Author Posted September 23, 2010 Thank you Smashly but I've got it to work and even changed from select to switch For $i = 192 to $y ; 286 ; The Start For $j = 285 to $x ; 193 ; The End $test = PixelGetColor ($j,$i) Switch $test ToolTip(Hex($test,6)) Case Hex($test,6) = $Green ToolTip("Green") Sleep(3000) Case Hex($test,6) = $Yellow ToolTip("Yellow") Sleep(3000) _WriteLog() Case Hex($test,6) = $Purple ToolTip("Purple") Sleep(3000) Case Hex($test,6) = $White ToolTip("White") Sleep(3000) Case $test = $Blue ToolTip("Blue") Sleep(3000) Case Hex($test,6) = $Orange ToolTip("Orange") Sleep(3000) Case Hex($test,6) = $Red ToolTip("Red") Sleep(3000) EndSwitch Next Next
smashly Posted September 23, 2010 Posted September 23, 2010 Hi, glad to hear you worked it out. Your Switch statement could use some work. Switch Hex($test,6) ;<- This is what Case is comparing against Case $Green ;<- So if Hex($test,6) = $Green then True No need to doSwitch $test Case Hex($test,6) = $Green Instead do something likeSwitch Hex($test,6) Case $Green Cheers
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