Jump to content
Sign in to follow this  
Alex1

Double Click?

Recommended Posts

Alex1

I'd like to make the mouse double click every 5 minutes. How do I do this?

Share this post


Link to post
Share on other sites
Pakku

Hi,

While 1
    $pos = MouseGetPos()
    MouseClick("left",$pos[0],$pos[1],2)
    Sleep(1000 * 60 * 5) 
WEnd

p.s. please first take a look at the help file :)

Edited by Pakku

Share this post


Link to post
Share on other sites
Paulie

I'd like to make the mouse double click every 5 minutes. How do I do this?

While 1
Mouseclick("Left",X, Y, 2, 0)
Sleep(5*60*1000)
WEnd
Edited by Paulie

Share this post


Link to post
Share on other sites
Pakku

While 1
Mouseclick("Left",X, Y, 2, 0)
Sleep(5*60*1000)
WEnd
i updated my post while you were adding one :)

Share this post


Link to post
Share on other sites
Paulie

i updated my post while you were adding one :)

lol i got beat...

Share this post


Link to post
Share on other sites
Alex1

hmm... why isn't this double clicking every 10 seconds

While 1

$slp = Random(20000, 60000, 1)

Sleep($slp)

Send("{F3}")

Sleep(5500)

Send("{F1}")

WEnd

While 1

$pos = MouseGetPos()

MouseClick("left",$pos[0],$pos[1],2)

Sleep(10000)

WEnd

Share this post


Link to post
Share on other sites
Paulie

hmm... why isn't this double clicking every 10 seconds

While 1

$slp = Random(20000, 60000, 1)

Sleep($slp)

Send("{F3}")

Sleep(5500)

Send("{F1}")

WEnd

While 1

$pos = MouseGetPos()

MouseClick("left",$pos[0],$pos[1],2)

Sleep(10000)

WEnd

Most likely because it is stuck in the first loop.

Share this post


Link to post
Share on other sites
Alex1

how do i make it not do that?

Share this post


Link to post
Share on other sites
Vindicator209

You've got 2 loops there:

While 1

$slp = Random(20000, 60000, 1)

Sleep($slp)

Send("{F3}")

Sleep(5500)

Send("{F1}")

WEnd

While 1

$pos = MouseGetPos()

MouseClick("left",$pos[0],$pos[1],2)

Sleep(10000)

WEnd

They happen one after nother, but since they are both infinite loops, the second doesnt get done, and I dont know enough about loops to tell you how to dodge that but you can do this:

$timer=TimerInit() ;set time 1

$timer2=TimerInit() ; set timer 2

$slp = Random(20000, 60000, 1) ;set random

While 1

If TimerDiff($timer) > 10000 Then ; Check timer 1

_Function1

EndIf

If TimerDiff($timer2) > $slp Then ; Check timer 2

_Function2

EndIf

Func _Function1() ;Function 1

$pos = MouseGetPos()

MouseClick("left",$pos[0],$pos[1],2)

$timer=TimerInit(); Reset Timer

EndFunc

Func _Function2()

$slp = Random(20000, 60000, 1)

$timer2=TimerInit(); Reset Timer

Send("{F3}")

Sleep(5500)

Send("{F1}")

EndFunc

I havent tested that but something along those lines should work

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites
Paulie

how do i make it not do that?

You can set a hotkey to do one and a different one for the other.

ie:

Hotkeyset("1", "_one")
Hotkeyset("2", "_two")

while 1
sleep(100)
WEnd

Func _one()
While 1
$slp = Random(20000, 60000, 1)
Sleep($slp)
Send("{F3}")
Sleep(5500)
Send("{F1}")
WEnd
EndFunc

Func _two()
While 1
$pos = MouseGetPos()
MouseClick("left",$pos[0],$pos[1],2)
Sleep(10000)
WEnd
EndFunc

Share this post


Link to post
Share on other sites
Alex1

hmm... Paulie it doesn't repeat on its own with that, though.

Share this post


Link to post
Share on other sites
Paulie

hmm... Paulie it doesn't repeat on its own with that, though.

It does for me....

You have to push the hotkeys to make it work though.

If you push 1, it will do the first loop (the one without clicking)

Then you push 2 and it wil stop doing the first loop and do the mouse clicks.

Share this post


Link to post
Share on other sites
Alex1

Well, my goal here is to be able to have a repeating loop the pressing f1 and f3, and a repeating loop of double clicking every 5 minutes (10 seconds for the test). I don't want to have to press 1 and 2 and stay at my computer for the script to work.

Thanks for all your help by the way, guys

Share this post


Link to post
Share on other sites
Vindicator209

You don't have to stay at your computer, just press 1 and 2 for the first time and it will do it on its own from then on =P

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites
Alex1

Well, when I press 2, the one script stops working. When I press 1, the 2 script stops working.

Share this post


Link to post
Share on other sites
Vindicator209

Really? well then make 2 scripts lol =P


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

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  

×