Jump to content
Sign in to follow this  
razer_anthom

MouseClick + Sleep

Recommended Posts

razer_anthom

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

Share this post


Link to post
Share on other sites
razer_anthom

make a loop

While 1
clicar("right", 50, 700)
Sleep(5000)
WEnd

<{POST_SNAPBACK}>

But I want just one click at that position... and with my code, I taking more .

Share this post


Link to post
Share on other sites
themax90

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

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  

×