How to use AutoHotkey to send a string to a game’s text entry line

autohotkey

The game I play has a single line chat box for user entry. It does not allow pasting text, and you can't create a group of preset greetings/messages etc either. So I need an AutoHotkey script where different keypresses will insert different messages.

I can send strings to Notepad, browser etc. but have no idea how to send it into the game as stated above.

I'm an experienced programmer but only downloaded AutoHotkey today. I also know that this is possible, as it has already been done for this particular game.

Best Answer

Right click on the AHK icon in the status tray, and select "Edit script". Delete what is there (I'm assuming you haven't done any scripting yourself) and paste this in it.

<your hotkey>::Send <your text>[{enter} (if you want it to automatically send]

Save it, close it, right click on the icon again, and click "Reload script". You will need to place your cursor in the chat box before you use the hotkey, unless there is a key which you can press to focus on the chatbox. In that case, put that key in the script ahead of <your text>. If you're unsure how to do so, let me know what the key is, and I'll add it into the answer.

Related Question