trying to make a script that holds down then lets go the key

Ask gaming related questions
idkbroski
Posts: 1
Joined: 17 Jan 2024, 17:55

trying to make a script that holds down then lets go the key

17 Jan 2024, 18:06

i have been struggling to make a script that holds down the letter e for about 3 seconds then lets it go for 3 seconds and then does it again on repeat forever until i press F5 (i would also like F5 to start and stop it please)
thank you for reading this i would be very thankful if you could do this for me also one of the main reason for this is because i am not used to ahk v2
User avatar
mikeyww
Posts: 27323
Joined: 09 Sep 2014, 18:38

Re: trying to make a script that holds down then lets go the key

18 Jan 2024, 06:08

Welcome to this AutoHotkey forum!

Code: Select all

#Requires AutoHotkey v2.0

F5:: {
 Static on := False
 If on ^= True {
  SetTimer(toggleState, 3000), toggleState()
  SoundBeep 1500
 } Else {
  SetTimer toggleState, 0
  If GetKeyState('e')
   toggleState
  SoundBeep(1000), Sleep(400), ToolTip()
 }
}

toggleState() {
 Send GetKeyState('e') ? '{e up}' : '{e down}'
 ToolTip GetKeyState('e')
}

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 3 guests