Sign in to follow this  
Followers 0
Hojima

need quickfix script to get mouse coordinates

2 posts in this topic

#1 ·  Posted (edited)

Can someone wrire me very simple code inorder to find the coordinate of the mouse with a GUI? By that I mean that I want to click a button, then click anywhere else on the screen for it to give me the coordinates. Please make it simple to follow. This is what I've tried so far:

#include <GUIConstants.au3>

GUICreate("My GUI")

GUISetState (@SW_SHOW)

$pressed=GUICtrlCreateButton ("Find Coordinate", 10, 30, 100)

While 1

$msg = GUIGetMsg()

if $pressed = $msg then

while 1

$msg = GUIGetMsg()

if $msg = $GUI_EVENT_PRIMARYDOWN Then

$pos = MouseGetPos()

MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1])

EndIf

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

WEnd

EndIf

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

What I basically need is a function that doesn't require a loop inorder to work, and a meathod to get coordinates out of the GUI

Edited by Hojima

Share this post


Link to post
Share on other sites



in case u dont know u can get the mouse corordinates from AU3Info which is in the autoit folder


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

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