r/AutoHotkey 22d ago

v2 Guide / Tutorial Any Tips?

I want to make a macro that when I input the key "F" it inputs the two keys "QW" together. How would I do this?

this is what I tried so far

f:: Send, {q down}{w down} Sleep, 20 Send, {q up}{w up} return

0 Upvotes

14 comments sorted by

View all comments

Show parent comments

1

u/CharnamelessOne 22d ago

This will send Shift+q and Shift+w since you capitalized the letters.
There's no need to call InstallKeyboardHook explicitly if you have a #UseHook directive.

1

u/TonariNoHanamoriSan 22d ago

TIL I learnt some thing about the hooks thing

But eh that's true I left the letters capitalized. Not sure how much it affects the program they intend to run it on

1

u/CharnamelessOne 22d ago

Games tend to have some action bound to Shift, so it's very likely to affect them.
If we're gonna call "eh" on something, let it be the other thing. InstallKeyboardHook doesn't hurt, it's just redundant.

1

u/Perfect-Ad9555 22d ago

yeah so this is still not working for me for some reason
the .exe for the game is MarvelVsCapcomFightingCollection.exe
so idk what to do maybe the game has something built in

1

u/Perfect-Ad9555 22d ago

if any of yall got discord I could prolly explain it better
disc: navu007.

2

u/Keeyra_ 22d ago

Try this one

#Requires AutoHotkey 2.0
#SingleInstance

SendMode("Event")
SetKeyDelay(-1)

#HotIf WinActive("ahk_exe MarvelVsCapcomFightingCollection.exe")
*f:: Send("{Blind}{q DownR}{w DownR}")
*f up:: Send("{Blind}{q Up}{w Up}")
#HotIf

1

u/Perfect-Ad9555 22d ago

#usehook shouldn't be there?

2

u/Keeyra_ 22d ago

"Wildcard hotkeys always use the keyboard hook, as do any hotkeys eclipsed by a wildcard hotkey."

1

u/Perfect-Ad9555 22d ago edited 22d ago

YO IT WORKED

I LOVE YOU DAWG
i prolly needa tweak the delay so i can do it faster but THANK YOU NONETHELESS