Jump to content

How do I prompt user to click the left mouse button?


Recommended Posts

Take a peek in the helpfile at the following functions.

MsgBox()

MouseGetPos()

MouseClickDrag()

Something along those lines.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to post
Share on other sites

Welcome to the forums.

You might try this code. (Change it as you need.)

;see the help file (desktop / app window?)
AutoItSetOption("MouseCoordMode", 1)


;this loop repeats until a left mouse click occurs
Do
    $pos1 = MouseGetPos()
    ToolTip("Click on first position." & @CR & _
            "Desktop X: " & $pos1[0] & ", " & "Y: " & $pos1[1])
    Sleep(10)
Until _IsPressed('01')
$pos1 = MouseGetPos()


;this loop repeats unitl the left mouse click is released
Do
    Sleep(10)
Until Not _IsPressed('01')


;this loop repeats until a left mouse click occurs again
Do
    $pos2 = MouseGetPos()
    ToolTip("Click on second position." & @CR & _
            "Desktop X: " & $pos2[0] & ", " & "Y: " & $pos2[1])
    Sleep(10)
Until _IsPressed('01')
$pos2 = MouseGetPos()


ToolTip("")
MsgBox(0, "1st", "Desktop X: " & $pos1[0] & ", " & "Y: " & $pos1[1])
MsgBox(0, "2nd", "Desktop X: " & $pos2[0] & ", " & "Y: " & $pos2[1])


;UDF by ezzetabi
Func _IsPressed($hexKey)
    
    Local $aR, $bO
    
    $hexKey = '0x' & $hexKey
    $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
    If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
        $bO = 1
    Else
        $bO = 0
    EndIf
    
    Return $bO
EndFunc  ;==>_IsPressed
You can read more about ezzetabi's "IsPressed" UDF here:

http://www.autoitscript.com/forum/index.php?showtopic=5760

Edited by herewasplato

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

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...