Jump to content

X,Y Coords and Pixel


DexterMorgan
 Share

Recommended Posts

This is probably the most basic thing you have ever seen on this forums.. But for the people that dont know,

This is a little tooltip with the X and Y coordinates of the mouse and the pixel color

If you press CTRL and P then it copies the pixel to the clipboard

CTRL and M for coords

Esc to exit

#NoTrayIcon
#include <Misc.au3>

While 1 
$pos = MouseGetPos()
$var = PixelGetColor( $pos[0] , $pos[1] )
ToolTip($pos[0] & "," & $pos[1] & @CRLF & Hex($var, 6) )
If _IsPressed(11) and _IsPressed(50) Then
    ClipPut( Hex($var, 6)) 
EndIf
If _IsPressed(11) and _IsPressed('4D') Then
    ClipPut( $pos[0] & "," & $pos[1]) 
EndIf
If _IsPressed('1B')  Then
    Exit
EndIf
WEnd
Edited by Konstig
code
Link to comment
Share on other sites

You are forgetting two things.

First, it will literary burn up your CPU since it uses 100%, you need a Sleep() in there.

Second, you should have read the page about _IsPressed more "in-depth".

If calling this function repeatidly, should open 'user32.dll' and pass in handle.

When these two things are added it is almost at 0% CPU usage.

#NoTrayIcon
#include <Misc.au3>

$dll = DllOpen("user32.dll")
While 1 
    $pos = MouseGetPos()
    $var = PixelGetColor( $pos[0] , $pos[1] )
    ToolTip($pos[0] & "," & $pos[1] & @CRLF & Hex($var, 6) )
    If _IsPressed(11, $dll) and _IsPressed(50, $dll) Then
        ClipPut( Hex($var, 6)) 
    EndIf
    If _IsPressed(11, $dll) and _IsPressed('4D', $dll) Then
        ClipPut( $pos[0] & "," & $pos[1]) 
    EndIf
    If _IsPressed('1B', $dll)  Then
        ExitLoop
    EndIf
    Sleep(10)
WEnd
DllClose($dll)
Link to comment
Share on other sites

You are forgetting two things.

First, it will literary burn up your CPU since it uses 100%, you need a Sleep() in there.

Second, you should have read the page about _IsPressed more "in-depth".

When these two things are added it is almost at 0% CPU usage.

#NoTrayIcon
#include <Misc.au3>

$dll = DllOpen("user32.dll")
While 1 
    $pos = MouseGetPos()
    $var = PixelGetColor( $pos[0] , $pos[1] )
    ToolTip($pos[0] & "," & $pos[1] & @CRLF & Hex($var, 6) )
    If _IsPressed(11, $dll) and _IsPressed(50, $dll) Then
        ClipPut( Hex($var, 6)) 
    EndIf
    If _IsPressed(11, $dll) and _IsPressed('4D', $dll) Then
        ClipPut( $pos[0] & "," & $pos[1]) 
    EndIf
    If _IsPressed('1B', $dll)  Then
        ExitLoop
    EndIf
    Sleep(10)
WEnd
DllClose($dll)
ohh.. well that works too.. Thanks :P
code
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...