Sign in to follow this  
Followers 0
b3lorixx

Wait for Mouse Click

4 posts in this topic

#1 ·  Posted (edited)

Im looking for a script that will wait for a mouse click then give the coords of the mouse click from within a Control so i can use Controlclick, ive tried _IfPressed and i have no luck.

Edited by b3lorixx

Share this post


Link to post
Share on other sites



http://www.autoitscript.com/autoit3/docs/functions/MouseGetPos.htm

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#include <Misc.au3>
#Include <WinAPI.au3>
HotKeySet("{esc}", "_exit")

$_Title     = "[CLASS:Notepad]"                                     ; I've used the text field in notepad as an example.
$_Text      = ""
$_ControlID = "[CLASS:Edit; INSTANCE:1]"

$hWnd = ControlGetHandle($_Title, $_Text, $_ControlID)              ; Get the handle of the control you want to check.

While 1
    If _IsPressed(0x01) Then                                        ; Check if left mouse button is clicked.
        $tPoint = _WinAPI_GetMousePos()                             ; Get the position of the mouse.
        If _WinAPI_WindowFromPoint($tPoint) = $hWnd Then            ; Retrieve the handle of the window that contains the specified point (mouse position) &
            MsgBox(0,"","The Cake Is Alive!")                       ; do stuff if the the handles are the same.
        EndIf
    EndIf
WEnd

Func _exit()
    Exit
EndFunc

Edit: Added some comments.

Edited by Cake

Share this post


Link to post
Share on other sites

Yes, however im using an IE embed (which i should have specified) and that method is not working

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