Jump to content

MouseClick + Sleep


Recommended Posts

Hello All...

I am making a script to send clicks to a window. Well, I am using MouseClick like this:

Func cliclar($m, $x, $y)

    MouseClick($m, $x, $y, 1, 1)
EndFunc

$m is the button ("right")

$x and $y are calculated.

Well, this code are sending more than one CLICK to that position. I tried This code too:

Func cliclar($m, $x, $y)

    MouseMove($x, $y, 0)
    Sleep(200)
    MouseDown($m)
    MouseUp($m)
EndFunc

and the same effect :dance:

There are a peace of code like this:

clicar("right", 50, 700)
    Sleep(5000)

And in this Sleep, it continues to click :whistle:

Do you have some suggestion?

Thanks for your attention.

Razer

PS.: I put this code on top of script:

AutoItSetOption("MouseClickDelay", 3)
AutoItSetOption("MouseClickDownDelay", 2)
Edited by razer_anthom
Link to comment
Share on other sites

You have an invalid or too fast MouseDelay option. If it's to fast, then it recycles but if it's in a valid time parameter, then it's fine. I'm sure that 3 miliseconds is no difference then 10:

; ----------------------------------------------------------------------------
; AutoIt Version: 3.1.1 Stable
; Author:        AutoIt Smith
; Script Function:
;   MouseClick Experimentation
; ----------------------------------------------------------------------------
AutoItSetOption("MouseClickDelay", 10)
MClick("Left", 50, 700)
Sleep(5000)
Func MClick($button, $x, $y)
    MouseClick($button, $x, $y, 1, 0)
EndFunc
#cs For the mouse then down up....
Func MClick($button, $x, $y)
    MouseMove($x, $y, 0)
    Sleep(100)
    MouseDown($button)
    MouseUp($button)
EndFunc
#ce

Enjoy!

AutoIt Smith

P.S. It's all timing dude! :whistle:

Edited by AutoIt Smith
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...