Need help with script to send keys :(

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
MuMPiTz
Posts: 3
Joined: 14 May 2024, 06:28

Need help with script to send keys :(

Post by MuMPiTz » 14 May 2024, 06:33

Hello. My Keyboard doesnt have a macro function. I found Autohotkey but my script never works and chatGPT also couldnt get it done for me. Can someone help me?

I basically want to do something like this. Hotkey could be F1. Sequence should be, keep CTRL pressed (maybe wait for a second before taking the next action), then press W S D then release CTRL. Then slightly different sequence for F2 and so on.
Does that work with Autohotkey and could someone maybe give an example of how the code would look like? Thanks!


[Mod edit: Added “to send keys” to subject line. Please use more descriptive subjects in the future. Everyone creating threads here needs help with a script.]

User avatar
boiler
Posts: 17242
Joined: 21 Dec 2014, 02:44

Re: Need help with script to send keys :(

Post by boiler » 14 May 2024, 06:39

Code: Select all

#Requires AutoHotkey v2.0

F1:: {
	Send '{Ctrl down}'
	Sleep 1000
	Send 'wsd{Ctrl up}'
}

MuMPiTz
Posts: 3
Joined: 14 May 2024, 06:28

Re: Need help with script to send keys :(

Post by MuMPiTz » 14 May 2024, 08:28

Thanks! It works. Sadly it only works outside of the game it was supposed to work for. I've had this problem with another software called "Macro Recorder" too. Maybe the game somehow sees it as cheating and doesnt allow other software to interfere? Anything that could be done in that case? I mean I dont consider this as cheating, you arent playing it against other humans, you play vs the computer. There is also no mention of macros being forbidden

User avatar
boiler
Posts: 17242
Joined: 21 Dec 2014, 02:44

Re: Need help with script to send keys :(

Post by boiler » 14 May 2024, 08:48

Some applications just don't respond to virtual keypresses. You could try running the script as administrator or otherwise address UAC.

I'm not a gamer, but since you brought it up... I don't see the distinction between playing against the computer and other humans. If you artificially are able gain an advantage in achieving whatever the goal is, you are able to get a better result than you would otherwise. If you consider that to be cheating against humans, it would seem to be cheating in general. I don't care to debate it, though.

MuMPiTz
Posts: 3
Joined: 14 May 2024, 06:28

Re: Need help with script to send keys :(

Post by MuMPiTz » 14 May 2024, 09:10

thanks!

User avatar
kunkel321
Posts: 1149
Joined: 30 Nov 2015, 21:19

Re: Need help with script to send keys :(

Post by kunkel321 » 14 May 2024, 09:41

It looks like this forum "Ask for Help (v2)" has a subforum, "Gaming." You might want to try asking there.
ste(phen|ve) kunkel

Post Reply

Return to “Ask for Help (v2)”