hold right click for a certain time

Get help with using AutoHotkey and its commands and hotkeys
pana
Posts: 3
Joined: 22 Jan 2021, 13:29

hold right click for a certain time

Post by pana » 22 Jan 2021, 13:34

Hello everyone,
I am new tho this.

Can someone provide me a script like , holding RightClick for 5 seconds then release for 5 seconds then again hold it for 5 seconds. doing like that untill i stop it.

Would appreciate.

Thanks
Anap
User avatar
mikeyww
Posts: 5237
Joined: 09 Sep 2014, 18:38

Re: hold right click for a certain time

Post by mikeyww » 22 Jan 2021, 14:38

Code: Select all

#MaxThreadsPerHotkey 2
wait := 5000
F3::
go := !go
While go {
 SoundBeep, 1500, 30
 Click, right, down
 Sleep, go ? wait : 0
 SoundBeep, 1000, 30
 Click, right, up
 Sleep, go ? wait : 0
}
Return
pana
Posts: 3
Joined: 22 Jan 2021, 13:29

Re: hold right click for a certain time

Post by pana » 22 Jan 2021, 15:06

how i can change the holding right click time time? and thee releasing click time?

would appreciate it,thanks
User avatar
mikeyww
Posts: 5237
Joined: 09 Sep 2014, 18:38

Re: hold right click for a certain time

Post by mikeyww » 22 Jan 2021, 15:21

Replace wait inside the While loop. You can put the number of milliseconds there.

Or:

Code: Select all

#MaxThreadsPerHotkey 2
holdTimeSec    := 5
releaseTimeSec := 5

F3::
go := !go
While go {
 SoundBeep, 1500, 30
 Click, right, down
 Sleep, go ? holdTimeSec * 1000 : 0
 SoundBeep, 1000, 30
 Click, right, up
 Sleep, go ? releaseTimeSec * 1000 : 0
}
Return
pana
Posts: 3
Joined: 22 Jan 2021, 13:29

Re: hold right click for a certain time

Post by pana » 22 Jan 2021, 15:47

thanks alot for help.

Appreciate it.
Post Reply

Return to “Ask For Help”