script help

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
redfoxyboi
Posts: 6
Joined: 29 Apr 2024, 17:43

script help

29 Apr 2024, 17:53

hi i am new to AHK, im trying to make a code that when the key "z" is held, it will spam the key "f" with 50ms intervals, indefinetly until the key "z" is released. help is much appreciated
Last edited by joedf on 29 Apr 2024, 18:10, edited 1 time in total.
Reason: Moved to "Ask For Help"
User avatar
mikeyww
Posts: 27146
Joined: 09 Sep 2014, 18:38

Re: script help

29 Apr 2024, 20:04

Welcome to this AutoHotkey forum!

Code: Select all

#Requires AutoHotkey v2.0

z:: {
 SetKeyDelay 50
 While GetKeyState(ThisHotkey, "P")
  SendEvent 'f'
}
redfoxyboi
Posts: 6
Joined: 29 Apr 2024, 17:43

Re: script help

30 Apr 2024, 12:22

hi, sorry i realised i needed shift and z, i found out the + sign means r but then i did +z but then it compiled, but displayed an error when opening the file
redfoxyboi
Posts: 6
Joined: 29 Apr 2024, 17:43

Re: script help

30 Apr 2024, 12:42

NVM I FOUND OUT HOW TO FIX IT

Code: Select all

LShift & r:: {
 SetKeyDelay 50
 While GetKeyState("r", "P") && GetKeyState("Lshift", "P")
  SendEvent 'f'
}
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Draken, Milincho and 36 guests