ISOHaven Posted September 8, 2005 Share Posted September 8, 2005 I guess the best thing to do would be to show you what I'm getting. This returns the hex value of the color at 200,400 on a specific screen. GOOD! $x = 200 $y = 400 $var = PixelGetColor( $x , $y ) ...msgbox $var... However this returns 0 even thou my mouse is on specific colors. BAD! $pos = MouseGetPos() $var = PixelGetColor( $pos[0] , $pos[1] ) ...msgbox $var... This also returns 0 (kinda reduntant) BAD! $pos = MouseGetPos() $x = $pos[0] $y = $pos[1] $var = PixelGetColor( $x , $y ) ...msgbox $var... So if I enter numbers into the variables it works fine. If I let MouseGetPos fill the variables then PixelGetColor fails. Am I dealing with bad "types" here? What I'm after is getting the hex value of the color under my mouse when I run the function specificly. So basicly, a color picker. Thanks for any help! Link to comment Share on other sites More sharing options...
Valuater Posted September 8, 2005 Share Posted September 8, 2005 I guess the best thing to do would be to show you what I'm getting. This returns the hex value of the color at 200,400 on a specific screen. GOOD!$x = 200$y = 400$var = PixelGetColor( $x , $y )...msgbox $var...However this returns 0 even thou my mouse is on specific colors. BAD!$pos = MouseGetPos()$var = PixelGetColor( $pos[0] , $pos[1] )...msgbox $var...This also returns 0 (kinda reduntant) BAD!$pos = MouseGetPos()$x = $pos[0]$y = $pos[1]$var = PixelGetColor( $x , $y )...msgbox $var...So if I enter numbers into the variables it works fine. If I let MouseGetPos fill the variables then PixelGetColor fails. Am I dealing with bad "types" here?What I'm after is getting the hex value of the color under my mouse when I run the function specificly. So basicly, a color picker.Thanks for any help!<{POST_SNAPBACK}>maybe this???MouseCoordMode Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:0 = relative coords to the active window1 = absolute screen coordinates (default)2 = relative coords to the client area of the active window put this in your script with the correct optOpt("MouseCoordMode", ?) ;1=absolute, 0=relative, 2=client8) Link to comment Share on other sites More sharing options...
ISOHaven Posted September 8, 2005 Author Share Posted September 8, 2005 Opt("MouseCoordMode", ?) ;1=absolute, 0=relative, 2=client<{POST_SNAPBACK}>Nada Link to comment Share on other sites More sharing options...
ISOHaven Posted September 8, 2005 Author Share Posted September 8, 2005 probably a game. probably has it's own mouse driver. custom driver probably breaks standard MS rules. probably gonna have to play the boring game without a bot.You lost me. I set the active window to my app which I made myself in vb.net and I need to pull up web templates and allow the user to click on a color and have it give them the HEX value. So no, this is in windows and in a window.Anyone else? Anyway to force $pos[0] to numeric? Link to comment Share on other sites More sharing options...
Valuater Posted September 8, 2005 Share Posted September 8, 2005 just for giggles try this $x = 200 $y = 400 $var = PixelGetColor( $x , $y ) msgbox(0,"", $var ) MouseMove($x, $y) 8) Link to comment Share on other sites More sharing options...
ISOHaven Posted September 8, 2005 Author Share Posted September 8, 2005 This is just ticking me off now. I did what you said above. Msgbox shows "F6D8CC" then moves to the right spot. Using numbers works fine. So I tried your MouseMove on my script: $pos = MouseGetPos() $var = PixelGetColor( $pos[0] , $pos[1] ) MsgBox(0,"The hex color is", Hex($var, 6)) MouseMove($pos[0], $pos[1]) I have to hit F10 to run this. So when I hit F10 with my mouse near the lower right corner of my screen the msgbox shows "000000" and after I click OK my mouse moves to the lower right hand corner. SO, MouseMove has no problem with those variables yet PixelGetColor does. Looks like I found a bug! Link to comment Share on other sites More sharing options...
Valuater Posted September 8, 2005 Share Posted September 8, 2005 I tried this numerous times and it always worked HotKeySet("{F8}", "Get_color" ) HotKeySet("{ESC}", "Exit_1") Func Get_color() $pos = MouseGetPos() $var = PixelGetColor( $pos[0] , $pos[1] ) MsgBox(0,"The hex color is", Hex($var, 6)) MouseMove($pos[0], $pos[1]) $pos = MouseGetPos() $var2 = PixelGetColor( $pos[0] , $pos[1] ) MsgBox(0,"The hex color is", Hex($var2, 6)) EndFunc Func Exit_1() Exit EndFunc While 1 sleep(10) WEnd 8) Link to comment Share on other sites More sharing options...
ISOHaven Posted September 8, 2005 Author Share Posted September 8, 2005 I tried this numerous times and it always workedHotKeySet("{F8}", "Get_color" ) HotKeySet("{ESC}", "Exit_1") Func Get_color() $pos = MouseGetPos() $var = PixelGetColor( $pos[0] , $pos[1] ) MsgBox(0,"The hex color is", Hex($var, 6)) MouseMove($pos[0], $pos[1]) $pos = MouseGetPos() $var2 = PixelGetColor( $pos[0] , $pos[1] ) MsgBox(0,"The hex color is", Hex($var2, 6)) EndFunc Func Exit_1() Exit EndFunc While 1 sleep(10) WEnd8)<{POST_SNAPBACK}>Then it's the control in my app. Since numeric works fine can we try forcing those variables to numberic? Any way to do that?Thanks for all your help!!!!!!! Link to comment Share on other sites More sharing options...
Valuater Posted September 8, 2005 Share Posted September 8, 2005 (edited) Then it's the control in my app. Since numeric works fine can we try forcing those variables to numberic? Any way to do that?Thanks for all your help!!!!!!!<{POST_SNAPBACK}>thats beyond me...butLarry is very sharp, reply to him and give him what he wants.... he knows his shite!8) Edited September 8, 2005 by Valuater Link to comment Share on other sites More sharing options...
/dev/null Posted September 8, 2005 Share Posted September 8, 2005 (edited) $pos = MouseGetPos() $var = PixelGetColor( $pos[0] , $pos[1] ) MsgBox(0,"The hex color is", Hex($var, 6)) MouseMove($pos[0], $pos[1])What are the coordinates after you move the mouse over your control?$pos = MouseGetPos() MsgBox(0,"The coordinates are:", "x: " & $pos[0] & " y: " & $pos[1]) $var = PixelGetColor( $pos[0] , $pos[1] ) MsgBox(0,"The hex color is", Hex($var, 6))Send the output of the two msgbox() statements.BTW: You're sure that you did not change MouseCoordMode from absoulte screen coordinates mode to relative mode?CheersKurt Edited September 8, 2005 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
ISOHaven Posted September 8, 2005 Author Share Posted September 8, 2005 (edited) What are the coordinates after you move the mouse over your control?$pos = MouseGetPos() MsgBox(0,"The coordinates are:", "x: " & $pos[0] & " y: " & $pos[1]) $var = PixelGetColor( $pos[0] , $pos[1] ) MsgBox(0,"The hex color is", Hex($var, 6))Send the output of the two msgbox() statements.BTW: You're sure that you did not change MouseCoordMode from absoulte screen coordinates mode to relative mode?CheersKurt<{POST_SNAPBACK}>Message Box 1: x: 353 y: 465Message Box 2: 000000This makes absolutly no sense what so ever. Even IsNumber returns 1. So that function gets numeric data yet returns 0.EDIT:...and yes I am not using MouseCoordMod. Edited September 8, 2005 by ISOHaven Link to comment Share on other sites More sharing options...
seandisanti Posted September 8, 2005 Share Posted September 8, 2005 Message Box 1: x: 353 y: 465Message Box 2: 000000This makes absolutly no sense what so ever. Even IsNumber returns 1. So that function gets numeric data yet returns 0.EDIT:...and yes I am not using MouseCoordMod.<{POST_SNAPBACK}>Number() converts expression to a number. but, one thing that i'm thinking though...maybe it's grabbing a piece of your cursor....try using this script to debug...while 1 $pos = MouseGetPos() $var = PixelGetColor( $pos[0]+2 , $pos[1]+2 ) tooltip($pos[0] & ", " & $pos[1] & " : " & $var) sleep(100) wend 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