d0n Posted December 20, 2007 Share Posted December 20, 2007 So i have this part of my script that didn't really work i am not sure why what its suppose to do is to show the hex color of the green dot but it doesn't #include "GUIConstants.au3" Global $pos = MouseGetPos(), $new_bobber = 0x00FF00 while 1 Capture_Pixel() WEnd ;Function to get Color/Coords of Mouse Position Func GetUnderMouse () ;gets mouse position $MouseCoord = MouseGetPos() ;finds color under mouse $MouseColor_var = PixelGetColor($MouseCoord[0] - 28,$MouseCoord[1] + 2) ;converts it to hex $MouseColor_hex = Hex ($MouseColor_var, 6) ;displays info $color = "0x" & $MouseColor_hex MsgBox (0,"Mouse Info", "Mouse Position = " & $Mousecoord[0]& "," & $Mousecoord[1] & " | MouseColor = " & $color ) EndFunc ;==>GetUnderMouse func capture_pixel() $a = GUICreate("GUI", 5, 5, $pos[0] - 30, $pos[1], $WS_POPUP, $WS_EX_TOPMOST ) GUISetBkColor($new_bobber, $a) GUISetState(@SW_SHOW) HotKeySet("z", "Getundermouse") While 1 $new = MouseGetPos() If $new[0] <> $pos[0] Or $new[1] <> $pos[1] Then WinMove("GUI", "", $new[0] - 30, $new[1]) EndIf $pos = $new Sleep(20) WEnd EndFunc Link to comment Share on other sites More sharing options...
xzaz Posted December 20, 2007 Share Posted December 20, 2007 $mousepos = MouseGetPos() $pixmouseget = PixelGetColor($mousepos[0],$mousepos[1]) $hexcolor = hex($pixmouseget,6) And just search the green dot? What is the function of the script? Small Color Picker v0.2 | Travian bot Link to comment Share on other sites More sharing options...
Madza91 Posted December 20, 2007 Share Posted December 20, 2007 Try to hide $a Gui before get the color [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
d0n Posted December 20, 2007 Author Share Posted December 20, 2007 this script is just to get the hex color at the green dot, for learning and a bot i am trying to make expandcollapse popup#include "GUIConstants.au3" Global $pos = MouseGetPos(), $new_bobber = 0x00FF00 while 1 Capture_Pixel() WEnd ;Function to get Color/Coords of Mouse Position Func GetUnderMouse () ;gets mouse position $MouseCoord = MouseGetPos() GUISetState(@SW_HIDE) ;finds color under mouse $MouseColor_var = PixelGetColor($MouseCoord[0] - 28,$MouseCoord[1] + 2) GUISetstate(@SW_SHOW) ;converts it to hex $MouseColor_hex = Hex ($MouseColor_var, 6) ;displays info $color = "0x" & $MouseColor_hex MsgBox (0,"Mouse Info", "Mouse Position = " & $Mousecoord[0]& "," & $Mousecoord[1] & " | MouseColor = " & $color ) EndFunc ;==>GetUnderMouse func capture_pixel() $a = GUICreate("GUI", 5, 5, $pos[0] - 30, $pos[1], $WS_POPUP, $WS_EX_TOPMOST ) GUISetBkColor($new_bobber, $a) GUISetState(@SW_SHOW) HotKeySet("z", "Getundermouse") While 1 $new = MouseGetPos() If $new[0] <> $pos[0] Or $new[1] <> $pos[1] Then WinMove("GUI", "", $new[0] - 30, $new[1]) EndIf $pos = $new Sleep(20) WEnd EndFunc i added the hide and show around the get color line but it still shows me the green color :S Link to comment Share on other sites More sharing options...
Madza91 Posted December 20, 2007 Share Posted December 20, 2007 Works for me.. [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
Madza91 Posted December 20, 2007 Share Posted December 20, 2007 Here is a little better code expandcollapse popup#include "GUIConstants.au3" Global $pos = MouseGetPos(), $new_bobber = 0x00FF00 Local $a $gui = GUICreate("") GUISetState(@SW_HIDE) while 1 Capture_Pixel() WEnd ;Function to get Color/Coords of Mouse Position Func GetUnderMouse () ;gets mouse position $MouseCoord = MouseGetPos() GUISetState(@SW_HIDE,$a) ;finds color under mouse $MouseColor_var = PixelGetColor($MouseCoord[0] - 28,$MouseCoord[1] + 2) ;converts it to hex $MouseColor_hex = Hex ($MouseColor_var, 6) ;displays info $color = "0x" & $MouseColor_hex MsgBox (0,"Mouse Info", "Mouse Position = " & $Mousecoord[0]& "," & $Mousecoord[1] & " | MouseColor = " & $color ) GUISetstate(@SW_SHOW,$a) EndFunc ;==>GetUnderMouse func capture_pixel() $a = GUICreate("GUI", 5, 5, $pos[0] - 30, $pos[1], $WS_POPUP, $WS_EX_TOPMOST,$gui) GUISetBkColor($new_bobber, $a) GUISetState(@SW_SHOW) HotKeySet("z", "Getundermouse") While 1 $new = MouseGetPos() If $new[0] <> $pos[0] Or $new[1] <> $pos[1] Then WinMove("GUI", "", $new[0] - 30, $new[1]) EndIf $pos = $new Sleep(20) WEnd EndFunc [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
d0n Posted December 20, 2007 Author Share Posted December 20, 2007 can you tell me what autoit you are using? Link to comment Share on other sites More sharing options...
Madza91 Posted December 20, 2007 Share Posted December 20, 2007 Autoit v3.2.8.1 [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
d0n Posted December 20, 2007 Author Share Posted December 20, 2007 i dont know why but i have to click it twice to get the real color, the first time it will give me the green dot i think and the 2nd time will give me the real color that i am looking for :S Link to comment Share on other sites More sharing options...
Madza91 Posted December 20, 2007 Share Posted December 20, 2007 I don't know why don't work :S try on some other way ... [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
d0n Posted December 20, 2007 Author Share Posted December 20, 2007 well it works but i have to click it twice to work. when u say it worked for you does it show u the color on the 1st click? or 2nd? Link to comment Share on other sites More sharing options...
Madza91 Posted December 20, 2007 Share Posted December 20, 2007 on 1st, because is before PixelGetColor puted GUISetState(@SW_HIDE,$a) ... GUISetState(@SW_HIDE,$a) $MouseColor_var = PixelGetColor($MouseCoord[0] - 28,$MouseCoord[1] + 2) i don't know why not work for you :S [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
jvanegmond Posted December 20, 2007 Share Posted December 20, 2007 I just noticed the title of this topic and I laughed my ass off. Getting the mouse color?! Well, maybe you could ask the user with an inputbox.. Something like this: $MouseColor = InputBox("Mouse Color","Hello there what is the color of your mouse? ") I would have answered Grey. So $MouseColor = "Grey". github.com/jvanegmond Link to comment Share on other sites More sharing options...
d0n Posted December 20, 2007 Author Share Posted December 20, 2007 (edited) mm, anyone out there can try it? i got the newest autoit, and i just copy pasted the code but same thing ^mine is black/blue! Edited December 20, 2007 by d0n Link to comment Share on other sites More sharing options...
jvanegmond Posted December 20, 2007 Share Posted December 20, 2007 This was quite obvious. It was not hiding the window fast enough, before it checked the color. A little bit of Sleep() fixed that problem. expandcollapse popup#include "GUIConstants.au3" Global $pos = MouseGetPos(), $new_bobber = 0x00FF00 Local $a $gui = GUICreate("") GUISetState(@SW_HIDE) while 1 Capture_Pixel() WEnd ;Function to get Color/Coords of Mouse Position Func GetUnderMouse () ;gets mouse position $MouseCoord = MouseGetPos() GUISetState(@SW_HIDE,$a) Sleep(50) ;finds color under mouse $MouseColor_var = PixelGetColor($MouseCoord[0] - 28,$MouseCoord[1] + 2) ;converts it to hex $MouseColor_hex = Hex ($MouseColor_var, 6) ;displays info $color = "0x" & $MouseColor_hex MsgBox (0,"Mouse Info", "Mouse Position = " & $Mousecoord[0]& "," & $Mousecoord[1] & " | MouseColor = " & $color ) GUISetstate(@SW_SHOW,$a) EndFunc ;==>GetUnderMouse func capture_pixel() $a = GUICreate("GUI", 5, 5, $pos[0] - 30, $pos[1], $WS_POPUP, $WS_EX_TOPMOST,$gui) GUISetBkColor($new_bobber, $a) GUISetState(@SW_SHOW) HotKeySet("z", "Getundermouse") While 1 $new = MouseGetPos() If $new[0] <> $pos[0] Or $new[1] <> $pos[1] Then WinMove("GUI", "", $new[0] - 30, $new[1]) EndIf $pos = $new Sleep(20) WEnd EndFunc github.com/jvanegmond Link to comment Share on other sites More sharing options...
d0n Posted December 20, 2007 Author Share Posted December 20, 2007 got it working now, just wonder why did it work for him but not me, maybe my comp is a bit slow? lol Thanks for all the help guys Link to comment Share on other sites More sharing options...
Madza91 Posted December 20, 2007 Share Posted December 20, 2007 Yes, very possible, your comp too slow hides gui and guick get pixel colors ;D [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) 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