View Full Version : Remapping Hotkeys - Alternative Solution
bail0ut
2nd Oct 06, 7:59 PM
I was having a tough time with the keyboard commands in the game so I decided that I would remap them. For this I amusing a program called autohotKey which is a free app available at www.autohotkey.com (http://www.autohotkey.com). Download that before continuing
In short this is a key remapping software that allows you to write scripts which can be enabled or disabled at any time. Typically I will start the script and then run the game (which can be done automatically, though I have left that out for now for simplicity). When you finish the game don't forget to stop your script or your keyboard will be messed up.
my script is as follows
;start of script
;reassigning the arrow keys
a::left
s::down
d::right
w::up
;reassigning the view keys
q::Backspace
e::alt
;end of script
Copy the text above to Notepad and save it with the extension ahk (example companyOfHeroes.ahk). To run the file simply double click it and it will appear in the tray.
As you can see the syntax is very simple. It is in essence the key you want to use followed by two colons and then the existing key in the game. there is an extensive help file with autohotkey that you can refer to as well to add additional keys (which I will be doing) and functionality
Hope this helps - let me know if you have any questions
bail0ut
darkhelmet
2nd Oct 06, 8:19 PM
Yeah, I was wondering why remapping was not included. Is there a way to remap the rotate view to the depressed middle mouse wheel? Slightly annoying taking my eyes off the screen to find the 'alt' key just to rotate the view.
Thanks.
bail0ut
2nd Oct 06, 8:47 PM
sure
Just replace the line
e::alt
with
MButton::alt
bail0ut
darkhelmet
3rd Oct 06, 6:02 PM
Yes, yes, yes - work just fine.
Thank you sir!
bail0ut
3rd Oct 06, 7:33 PM
No problem -
I am working on an addition so that the script is only active for the game
bail0ut
I've been using the same program for a long time now for all my games. I highly recommend it as well!
project_demon
3rd Oct 06, 9:41 PM
remap keyboard? what happens when you chat? For example if you remapped "a" will you still be able to type a?
bail0ut
4th Oct 06, 7:09 AM
project_demon
good question, I have only been playing the single player mission so I have not had that issue. Luckily it is easy to pause a script as well. For example you could setup a hotkey (let's say Ctrl-T) which will both disable the script and start the chat box. You would then use the enter key (I assume that this is what is used to send the line of chat as in all programs) to enable the script again.
I'm not sure of the exact syntax but i believe this would work. I am assuming that "T" is used to start a chat line (don't have the manual with me), and that enter sends the line.
^t:: ;this assigns ctrl-t to start a chat box
SendInput T ;this sends the keystroke T to the game to start a chat window
Suspend ;this suspends the script
Exit ;End this block of code
enter::suspend ;this restarts the script once you are done chatting no need to exit as there is only 1 line
Can someone try this out and let me know. Hope it works. Also if someone sends me all of the keystrokes in the game I will setup the file so it can be easily edited.
thanks
bail0ut
djukel
4th Oct 06, 9:25 AM
Sweet! I just today wanted to rebind arrow keys.
MeatPacker
4th Oct 06, 11:21 AM
"Yeah, I was wondering why remapping was not included. Is there a way to remap the rotate view to the depressed middle mouse wheel? Slightly annoying taking my eyes off the screen to find the 'alt' key just to rotate the view."
I have a similar question about depressed mouse wheel panning... the default scrolling is totally annoying, unintuitive, and to my senses it renders the function useless. I can kind of see the point of doing it the default way, like you are dragging the map around with your hand, but DoW allows you to reverse the mouse pan in the controls menu, so it mystifies me why CoH doesn't allow the same.
step2ice
4th Oct 06, 12:28 PM
I tried autohotkey with DoW and Generals but neither of that games worked with it.
Maybe CoH will do.
Currently I'm using perfect keyboard pro.
Another nice, simple and free macro tool is MacroMaker.
Just google for it.
bail0ut
4th Oct 06, 7:13 PM
OK
I have updated the script a little bit so that
1. When you launch the script it will launch the game (assumes default installation path)
2. The Keyboard commands are only applicable in the game
3. Chatting will work as normal by pressing Ctrl-T to start chatting and Enter to end chatting
4. The 4th mouse button is used as the Alt key
5. Enter key can be used at any time to toggle the script on/off
;Start of Script
Run, RelicCOH.exe, C:\Program Files\THQ\Company of Heroes\
SetTitleMatchMode, 2
#IfWinActive Company Of Heroes
a::left ;assign a to left arrow
s::down ;assign s to down arrow
d::right ;assign d to right arrow
w::up ;assign w to up arrow
XButton1::alt ;assign the 4th mouse button to alt
^t:: ;this assigns ctrl-t to start a chat box
Send {enter};this sends the keystroke enter to the game to start a chat window
Suspend ;this suspends the script so that you can type without hotkeys active
Exit ;End this block of code
enter::suspend ;this restarts the script once you are done chatting
;End of Script
Ideas, suggestion, comments... let me know
bail0ut
DrunkenOne
4th Oct 06, 7:14 PM
Bridgers hotkey thing pwns.
bail0ut
4th Oct 06, 7:35 PM
Yah bridgers hotkey thing is pretty sweet - this is low tech and is really just for moving the scroll keys and view control
bail0ut
darkhelmet
30th Oct 06, 9:22 AM
Thanks bailout, but I tried on my own - what did I do wrong here?
;start of script
;reassigning the arrow keys
a::left
s::down
d::right
w::up
;reassigning the view keys
q::Backspace
MButton::alt
capslock::0
;end of script
I was trying to change the Map key "0" to the caps lock key, but when in the game the 0 key still works and the caps lock does nothing.
bail0ut
30th Oct 06, 10:34 AM
Here are 2 things that you can try
1. I believe that the program is case sensitive so try using
CapsLock::0 (as opposed to "capslock")
2. If you are trying to map the 0 key from the keypad (vs the zero key between the 9 key and minus key) you need to specify this, the command would be as follows
CapsLock::Numpad0
Hope that this helps - Let me know
bail0ut
Laz4rus
30th Oct 06, 2:44 PM
What exactly is the problem with the normal way to remap the hotkeys?
http://wiki.reliccommunity.com/Modding:Company_of_Heroes/Hotkeys
If you search for bridgers grid keys on the forum you even get a version where you don't have to fiddle around with the sga packer.
meatb@ll
30th Oct 06, 3:11 PM
The only advantage I can tell is that this way doesnt modify any CoH files so you don't have to worry about removing the modded hotkeys when you patch the game. It's also a bit easier to do for those technically impaired users.
Otherwise, it's just another process running in the background effecting performance - even though it probally uses very little CPU.
bail0ut
30th Oct 06, 6:40 PM
Laz4rus
Nothing special about this workaround - just an alternative. The one nice thing that it allows for is remapping the mouse buttons.
I have used bridgers system and it is very good, but personally I just want to remap a few keys and I find this very simple.
bail0ut
dvbuljan
11th Nov 06, 12:10 PM
How to remap Pause key to Space?
I have put:
Pause::Space ;Pause in Space key
but nothing happens! :hmm:
Please help! :help:
DayGloNinja
11th Nov 06, 12:21 PM
can anyone write a script to remap the screen print button to something like shift+ctrl+C? I have a mac book pro that doesn;t have a print screen button and I would like a work around.
bail0ut
11th Nov 06, 5:26 PM
dvbuljan,
You have it almost right except you need to reverse the order.
Space::Pause
let me know if that works
--------
DayGloNinja
Assuming autohotkey works on a mac you can try adding the following line to your script
^+C::PrintScreen ;maps Ctrl-Shift-C to printscreen
Hope that helps. How is the performance on the Mac btw?
bail0ut
MadCatChiken
11th Nov 06, 5:43 PM
Key remapping was done awhile ago.
http://tales.tsncentral.com/?p=83
bail0ut
11th Nov 06, 5:57 PM
MadCatChicken -
as mentioned earlier, this is an alternative. Use it if you wish or use bridgers system. Luckily we live in a world with options.
I even edited the topic so there is no confusion
bail0ut
DayGloNinja
11th Nov 06, 10:52 PM
Bail0ut...
Thanks. I'll try that. The mac kicks ass... Graphics look amazing. Game speed is really fast too.
It's a core duo with 2gbs of ram so it chugs.
dvbuljan
12th Nov 06, 5:02 AM
Yes bail0ut, I noticed that :bag: so I change the order but nothing happens!? Both old and new pause keys are not working!:cry:
bail0ut
12th Nov 06, 6:19 AM
dvbuljan
Hmmmm, give this a try
space:: send, {pause}
let me know if that helps
bail0ut
MadCatChiken
12th Nov 06, 11:08 AM
MadCatChicken -
as mentioned earlier, this is an alternative. Use it if you wish or use bridgers system. Luckily we live in a world with options.
I even edited the topic so there is no confusion
bail0ut
Oh ok. My bad.
MCC.:chicken:
dvbuljan
12th Nov 06, 1:42 PM
That works! :bow2:
Thank you very much bail0ut! :howdy:
jamestr234
13th Nov 06, 8:17 AM
space:: send, {pause}
moving the pause key rocks! :D
http://www.autohotkey.com/
Exaercase
28th Feb 07, 10:45 AM
Thx a lot for the Pause trick i've search for so long time and enjoy better the game with space for paue and pereapth i'll try Dawn of War that i not want play 'cause of the pause.
Thx again you are the best !!!!!:banana:
Heu just a question how automaticly end the script at the end of the CoH i've try IfWinExist Company with the # or not and nothing work somthing have an idea ?????
bail0ut
28th Feb 07, 2:32 PM
Exaercase,
If you would like to autoexit the script (for example when the application closes) you can add in the following
Loop
{
Sleep 5000
IfWinNotExist, WindowNameHere
{
Exit
}
}
You will need to replace "WindowNameHere' with whatever the COH window is called (I am not at my computer so I can't remember off hand what it is). This is basically a loop that will run continuously until the game is closed. The reason I put in the 5 second sleep at the start is that I want a delay in the script so that if you are also using this to load the game, the launch will not be aborted
Hope that this helps
bail0ut
vBulletin v3.0.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.