Jump to content

Recommended Posts

Posted (edited)

I'm reading screen coords from an ini file. They are put their by another script that asks a user to click on certain items.

To verify they are valid I was just going to do a PixelGetColor and look for a -1 if they were invalid.

However using the coords X=9000 Y=9000 The result is 664682.

However my screen resolution is 1024X768.

What am I doing wrong?

Thanks,

Kenny

$DiscTypeX=9000
$DiscTypeY=9000
MsgBox(4096,"Color", PixelGetColor ($DiscTypeX, $DiscTypeY))
Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Posted (edited)

if you don't need to work with the color of a pixel, you can check the co-ords against the screen size.

$DiscTypeX=9000
$DiscTypeY=9000
MsgBox(4096,"Color", PixelGetColor ($DiscTypeX, $DiscTypeY))
MsgBox(4096,"Is Inside?",_IsInsideScreen($DiscTypeX,$DiscTypeY))

Func _IsInsideScreen($x,$y,$screenX = 0,$screenY = 0)
    If $screenX = 0 Then $screenX = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', 78)
    If $screenY = 0 Then $screenY = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', 79)
    If $x > $screenX[0] Or $x < 0 Or $y > $screenY[0] Or $y < 0 Then Return 0
    Return 1
EndFunc
Edited by spudw2k
Posted

Perfect, yeah I just want to make sure it's a coordinate the mouse can actually get to so the macro doesn't go nuts lol

Thanks man :P

Kenny

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

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
×
×
  • Create New...