Jump to content
Sign in to follow this  
Gash05

MouseGetPos Help

Recommended Posts

Gash05

I've looked over the help file a little bit, and I've found what command I need, but I have no idea how to put it together. Here's what I want

Dialog box w/instructions ==> User moves mouse to desired coord ==> User clicks left mouse button ==> MouseGetPos records position ===> Recorded position is assigned a variable

Anyone know how to do this? The concept seems easy, and I'm actually embarassed that I cannot figure it out. Please help?

I know that I need an if statement (I think) so when the 01 button is pressed (left mouse), then AutoIt will record the coord and place it in a variable.

Edited by Gash05

Share this post


Link to post
Share on other sites
Gash05

Something like this?

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    If _IsPressed("01", $dll) Then
        $cord = MouseGetPos()
        MsgBox(0, "", "x = " & $cord[0] & " y = " & $cord[1] )
    EndIf
    
    Sleep(10)
WEnd
DllClose($dll)
It seems like it'll work but I'm at work right now so I can't test it :lmao:

What is the purpose of the.dll part? Is it neccessary?

Share this post


Link to post
Share on other sites
SmOke_N

It seems like it'll work but I'm at work right now so I can't test it :lmao:

What is the purpose of the.dll part? Is it neccessary?

Only if you want to use _IsPressed().

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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  

×