Sign in to follow this  
Followers 0
ISOHaven

Variable "type" Trouble?

12 posts in this topic

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!

Share this post


Link to post
Share on other sites



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 window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the active window

put this in your script with the correct opt

Opt("MouseCoordMode", ?)       ;1=absolute, 0=relative, 2=client

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Opt("MouseCoordMode", ?)       ;1=absolute, 0=relative, 2=client

<{POST_SNAPBACK}>

Nada :whistle:

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

just for giggles try this

$x = 200
$y = 400
$var = PixelGetColor( $x , $y )
msgbox(0,"", $var )
MouseMove($x, $y)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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)


NEWHeader1.png

Share this post


Link to post
Share on other sites

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)

<{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!!!!!!!

Share this post


Link to post
Share on other sites

#9 ·  Posted (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...but

Larry is very sharp, reply to him and give him what he wants.... he knows his shite!

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#10 ·  Posted (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?

Cheers

Kurt

Edited 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 *

Share this post


Link to post
Share on other sites

#11 ·  Posted (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?

Cheers

Kurt

<{POST_SNAPBACK}>

Message Box 1: x: 353 y: 465

Message Box 2: 000000

This 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 by ISOHaven

Share this post


Link to post
Share on other sites

Message Box 1: x: 353 y: 465

Message Box 2: 000000

This 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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0