3

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.

2 Answers 2

1

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.

8
  • I used !n::Send {F6} hola {enter} (with and without return lol)
    – Doclands
    Sep 10, 2012 at 19:10
  • So my answer worked for you?
    – SaintWacko
    Sep 10, 2012 at 19:42
  • Sorry- how stupid of me lol - no sorry it didn't :( The F6 I had already tried - it works as a keypress to activate the chatbar but did not work via the Autohotkey script) - yes, I did reload etc. and also tried Send, SendInput, etc. etc. - ran out of ideas lol Thanks for your input, by the way - appreciated.
    – Doclands
    Sep 10, 2012 at 20:03
  • Does it work if you remove {F6} and manually activate the chatbar before using the hotkey?
    – SaintWacko
    Sep 10, 2012 at 20:20
  • Nope - can tell we are both programmers - tried that as well lol It does work in browser and uses the F6 shortcut properly etc. as you would expect it also works for TeamSpeak I know the autohotkey does work as I want it for the game I play (WWIIOnline) but I don't know how - or who wrote it - I am trying to find out:)
    – Doclands
    Sep 10, 2012 at 20:32
1

This finally worked for me:

  1. The game window title is needed so that it can be activated (if your game is FULL screen then use ALt TAB and the window Title will be obvious) - note - making the cursor iactive in the game chat window does not make the window active for this type of thing!
  2. You need a pause or the text will not register
  3. The hotkey must be called from outside the game! There will probably be better ways of achieving all this but it works, so for now that will do!
  4. Replace WWIIOL with Untitled - Notepad (having opened a new txt doc in Notepad and you will see how it works - yes you can do this in other ways but for a game this is all I can find that works.

Script:

!m::
IfWinExist, WWIIOL 
{WinActivate ; use the window found above
 Sleep, 200 ; wait for 200ms
 Send {F6} HELLO {Enter}
}
else
 Msgbox Hello
return

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .