Jump to content

How to moniter a mouse click ?


ulti
 Share

Recommended Posts

Hello Autoit team has been a while since i posted on these here forums since i have not been useing Autoit.

but recently i have

i am trying to make mouse click an area and then move back to whare mouse was before it clicked that new area and is working fine.

now i want to make it so the script pauses or dosent click the area defined if the mose is doing something mainly currently clicking down on an item "click drag" i cant seam to find out whare i would find that option to monitor a mouse event and then how i would use that information to stop the script and start it again on release of the mouse button. any one have any idears?

keep in mind i am still heavly learning. here is my code as it stands atm

HotKeySet("^{F9}","Quit")
HotKeySet("^{F8}","Start")
HotKeySet("^{F7}","Stop")


Global $RUN = False
$pos = MouseGetPos()

While 1

    If $RUN Then ClickPoint()
    Sleep(900)
WEnd

Func Start()
    $RUN =  True
EndFunc

Func Stop()
    $RUN = False
EndFunc

Func ClickPoint()
    $pos = MouseGetPos()
    MouseClick("left",246,589,1,0)
    MouseMove($pos[0], $pos[1],0)
EndFunc

Func Quit()
    Exit
EndFunc
Edited by ulti
Link to comment
Share on other sites

Check out:

MouseClick ;Perform a mouse click operation.
MouseClickDrag ;Perform a mouse click and drag operation.
MouseDown ;Perform a mouse down event at the current mouse position.
MouseGetCursor ;Returns the cursor ID Number for the current Mouse Cursor.
MouseGetPos ;Retrieves the current position of the mouse cursor.
MouseMove ;Moves the mouse pointer.
MouseUp ;Perform a mouse up event at the current mouse position.
MouseWheel ;Moves the mouse wheel up or down. NT/2000/XP ONLY.

OR:

#Include <Misc.au3>
_IsPressed($sHexKey [, $vDLL = 'user32.dll'])
Edited by rogue5099
Link to comment
Share on other sites

now i want to make it so the script pauses or dosent click the area defined if the mose is doing something mainly currently clicking down on an item "click drag" i cant seam to find out whare i would find that option to monitor a mouse event and then how i would use that information to stop the script and start it again on release of the mouse button. any one have any idears?

Posted Image

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Link to comment
Share on other sites

well to the people that helped thanks a bundle, here is what i came up with.

HotKeySet("^{F9}","Quit") ;press CTRL+F9 to exit
HotKeySet("^{F8}","Start")
HotKeySet("^{F7}","Stop")
#Include <Misc.au3>

$dll = DllOpen("user32.dll")

$lmb = 01
Global $RUN = False
$pos = MouseGetPos()

While 1

    If $RUN Then ClickPoint()
    Sleep(900)
WEnd

Func Start()
    $RUN =  True
EndFunc

Func Stop()
    $RUN = False
EndFunc

Func ClickPoint()
    $pos = MouseGetPos()
    if _IsPressed($lmb ,$dll)= 0 then
    MouseClick("left",240,562,1,0)
    MouseMove($pos[0], $pos[1],0)
    EndIf
EndFunc

Func Quit()
    Exit
EndFunc
Edited by ulti
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...