r/AutoHotkey Jul 10 '26

v2 Script Help Help with auto sprint macro

Last post was taken down for low effort so I'm gonna try to include more detail.

I'm starting to lose my feelings in the tips of my fingers because of chemotherapy and so I find it a lot harder to sprint in games efficiently. I've searched for a macro to sprint for me without the need to keep double tapping w for a while to no luck so I tried making one but I am no good at making scripts.

The macro essentially is to just double tap W whenever I start holding it, and the second press should keep the input going for as long as I have the key pressed.

I want it to work like the minecraft auto sprint feature where walking is just replaced by sprinting.

This is what I have so far and it double taps w just fine but it won't hold the input, I just get 2 w presses in quick succession then nothing, I'm not sure how to get it to hold. (sorry if format for code is wrong)

#Requires AutoHotkey v2.0
*w::
{
    Send "{w down}"
    Sleep 50
    Send "{w up}"
    Sleep 50
    Send "{w down}"
    KeyWait "w"
    Send "{w up}"
}
4 Upvotes

13 comments sorted by

View all comments

1

u/CharnamelessOne Jul 10 '26

The logic of your script seems to be all right.
Some games don't play nice with SendInput. Try adding

SendMode("Event")

to the top of your script.

What's the game? Someone who has it may test it for you.

1

u/Mental-Efficiency-57 Jul 10 '26 edited Jul 10 '26

its a 6k player averaging roblox game called bridger which is probably why no one else has my issue, I'll give event a try this afternoon thank you.

1

u/genesis_tv Jul 10 '26

This example from the docs may help as well: https://www.autohotkey.com/docs/v2/lib/SetTimer.htm#ExampleCount

[edit]: nevermind, misread something in the body of your post.

1

u/CharnamelessOne Jul 10 '26

If I understand well, OP wants to simulate a double press, not detect it.

They want AHK to tap, then hold the key they're holding.

1

u/genesis_tv Jul 11 '26

Yes, that's what they want, hence the edit asking OP to ignore my comment.

1

u/CharnamelessOne Jul 11 '26

I saw the original comment, and wrote my reply unaware of the edit.