schilbiz Posted December 5, 2007 Posted December 5, 2007 I found this while I was working on getting a better understanding of: MouseGetPos, PixelGetColor and ToolTip, it looks like it should do about exactly what I want it to, but it doesn't seem to do anything in its current condition. Would someone explain how this works, or should work? Func SelectColor($color_bg) sleep(100) $msg = "Left Click on color to Record " while 1 $xy = MouseGetPos() $currentpixel = PixelGetColor($xy[0],$xy[1]) ToolTip("Pixel color: " & $currentpixel & @LF & $msg) If _IsPressed("01") Then GUICtrlSetBkColor($display_Color,$currentpixel) GUICtrlSetData($display_Color,$currentpixel) $Color_Hex = $currentpixel ExitLoop EndIf Sleep(25) WEnd EndFunc
DW1 Posted December 5, 2007 Posted December 5, 2007 It looks like it should work fine... it is changing a GUI background AutoIt3 Online Help
schilbiz Posted December 5, 2007 Author Posted December 5, 2007 Thats what I thought as well, but it does not mention anything via ToolTip: ToolTip("Pixel color: " & $currentpixel & @LF & $msg)
PsaltyDS Posted December 5, 2007 Posted December 5, 2007 I found this while I was working on getting a better understanding of: MouseGetPos, PixelGetColor and ToolTip, it looks like it should do about exactly what I want it to, but it doesn't seem to do anything in its current condition. Would someone explain how this works, or should work? That is not a complete script. You have a function declaration with no calls to run the function. Inside that function you have references to Global variables like $display_Color and possibly $Color_Hex for which there is no usage outside the function. It uses an include file that isn't shown, and has an input parameter that isn't used. Try this as an educational demo: #include <misc.au3> HotKeySet("{ESC}", "_Quit") While 1 $avAnswer = SelectColor() MsgBox(64, "Results", $avAnswer[0] & "," & $avAnswer[1] & " = 0x" & Hex($avAnswer[2], 6)) WEnd Func SelectColor() Sleep(100) Local $msg = "Left Click on color to Record " While 1 $xy = MouseGetPos() $currentpixel = PixelGetColor($xy[0], $xy[1]) ToolTip("Pixel location: " & $xy[0] & "," & $xy[1] & @LF & _ "Pixel color: 0x" & Hex($currentpixel, 6) & @LF & _ $msg) If _IsPressed("01") Then Local $avRET[3] = [$xy[0], $xy[1], $currentpixel] Return $avRET EndIf Sleep(25) WEnd EndFunc ;==>SelectColor Func _Quit() Exit EndFunc ;==>_Quit 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
schilbiz Posted December 5, 2007 Author Posted December 5, 2007 That is not a complete script. You have a function declaration with no calls to run the function. Inside that function you have references to Global variables like $display_Color and possibly $Color_Hex for which there is no usage outside the function. It uses an include file that isn't shown, and has an input parameter that isn't used. Try this as an educational demo: #include <misc.au3> HotKeySet("{ESC}", "_Quit") While 1 $avAnswer = SelectColor() MsgBox(64, "Results", $avAnswer[0] & "," & $avAnswer[1] & " = 0x" & Hex($avAnswer[2], 6)) WEnd Func SelectColor() Sleep(100) Local $msg = "Left Click on color to Record " While 1 $xy = MouseGetPos() $currentpixel = PixelGetColor($xy[0], $xy[1]) ToolTip("Pixel location: " & $xy[0] & "," & $xy[1] & @LF & _ "Pixel color: 0x" & Hex($currentpixel, 6) & @LF & _ $msg) If _IsPressed("01") Then Local $avRET[3] = [$xy[0], $xy[1], $currentpixel] Return $avRET EndIf Sleep(25) WEnd EndFunc ;==>SelectColor Func _Quit() Exit EndFunc ;==>_Quit Yea i was wondering about the $color_bg. Now that is one nice little program! You basically showed me how to do about 3 things I have been working on figuring out, Thanks man.
PsaltyDS Posted December 5, 2007 Posted December 5, 2007 Yea i was wondering about the $color_bg. Now that is one nice little program! You basically showed me how to do about 3 things I have been working on figuring out, Thanks man.You're welcome. 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
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