Sign in to follow this  
Followers 0
NELyon

Mouse Co-Ords

6 posts in this topic

I was wondering if someone could help me. I need just a simple window, nothing but text that tells me the mouses X*Y Coordinates(sp?). could anyone help me out?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$xy = MouseGetPos()
msgbox(0, "Mouse Coordinates", "X position = " & $xy[0] & @CRLF & "Y Position = " & $xy[1])

Nomad :D

Edited by Nomad

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
GUICreate("Mouse Coords", 200, 200) ;This Creates the GUI Window
$xpos = GUICtrlCreateLabel("Ordinate X: ", 10, 10, 200) ;This creates a label.
$ypos = GUICtrlCreateLabel("Ordinate Y: ", 10, 30, 200) ;This creates another label.
GUISetState(@SW_SHOW) ;We need to do this, so the GUI will show up.
While 1 ;While loop.
    $Mpos = MouseGetPos() ;We get the position of the mouse.
    GUICtrlSetData($xpos, "Ordinate X: " & $Mpos[0]) ;Changes the label to the current mouse position.
    GUICtrlSetData($ypos, "Ordinate Y: " & $Mpos[1]) ;Changes the label to the current mouse position.
    $msg = GUIGetMsg() ;Get whatever has been pressed.
        Select ;Begin Case Statement
            Case $msg = $GUI_EVENT_CLOSE ;If the exit button is pressed then
                Exit ;exit the program
        EndSelect ;end the case statement.
WEnd ;continue the loop

Share this post


Link to post
Share on other sites

...and yet another way to do that:

AutoItSetOption("MouseCoordMode", 1)
;Use Mouse Coordinates relative to window (1-rel to desktop)

While 1
    $pos = MouseGetPos()
    ToolTip("Desktop X: " & $pos[0] & ", " & "Desktop Y: " & $pos[1])
    Sleep(10)
WEnd


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

CHRIS, yours is exactly what i need! thank you.

Share this post


Link to post
Share on other sites

CHRIS, yours is exactly what i need! thank you.

np.

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