Hello everyone,
I am new to AHK and trying to write a script that executes the following:
Pressing the r button sends r normally, but after pressing it, for 20 seconds pressing r sends x instead.
Since all my attemts do not work, i wanted to ask, if anybody could help me with this script.
Thanks alot in advance and have a nice day!
Looking for help with a script
Re: Looking for help with a script
Welcome to this AutoHotkey forum!
If you are new to AHK, I recommend using its current version, which is v2, instead of this older deprecated version that is no longer developed.
Code: Select all
#Requires AutoHotkey v1.1.33.11
$r::
end := A_TickCount + 20000
SetKeyDelay 25, 25
While GetKeyState("r", "P")
SendEvent % A_TickCount < end ? "r" : "x"
Return
Re: Looking for help with a script
Hello and thanks alot for the help!
I do not know if i am doing something wrong, but when i run the script it just sends two r presses when i press r and never sends x. Is there something i am doing wrrong?
Thanks alot forr the help, i will also check out v2.
I do not know if i am doing something wrong, but when i run the script it just sends two r presses when i press r and never sends x. Is there something i am doing wrrong?
Thanks alot forr the help, i will also check out v2.
Re: Looking for help with a script
Test in Notepad.
What the script does:
What the script does:
If you wish, change the number in the script. The number of milliseconds is shown there on line 4.Pressing the r button sends r normally, but after pressing it, for 20 seconds pressing r sends x instead.
Re: Looking for help with a script
Hmm sorry maybe i did not make clear what i want the script to do. Sorry english is not my native language.
Id like the script to do the following: After pressing and sending r, for a period of 20 seconds, pressing r will only send x. Notepad should like this:
rxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (20sec) rxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (20sec) ....
Sorry for my miscommunication and thanks alot for all the help!
Id like the script to do the following: After pressing and sending r, for a period of 20 seconds, pressing r will only send x. Notepad should like this:
rxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (20sec) rxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (20sec) ....
Sorry for my miscommunication and thanks alot for all the help!
Re: Looking for help with a script
You have the tools here, so with your interest in writing a script, you can start to adjust the code to match your description. The revised script below is a start.
Code: Select all
#Requires AutoHotkey v1.1.33.11
$r::
SetKeyDelay 25, 25
While GetKeyState("r", "P") {
SendEvent r
end := A_TickCount + 20000
While GetKeyState("r", "P") && A_TickCount < end
SendEvent x
}
Return
Re: Looking for help with a script
If i guessing correctly , what you're asking is to replace "r" with "x" during the period of "CD timing". r(2nd) will not be output again whether it is pressing , holding or tapping(released).Moongoose wrote: ↑29 Apr 2024, 06:17Hmm sorry maybe i did not make clear what i want the script to do. Sorry english is not my native language.
Id like the script to do the following: After pressing and sending r, for a period of 20 seconds, pressing r will only send x. Notepad should like this:
rxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (20sec) rxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (20sec) ....
Sorry for my miscommunication and thanks alot for all the help!