Jump to content

MouseGetPos Help


 Share

Recommended Posts

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • Moderators

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.

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...