Explore GameReplays...

Company of Heroes

My Company of Heroes Autohotkey Script

Reply to this topic Start new topic
# 1redbullzuiper Oct 13 2021, 12:23 PM
Feel free to use my Autohotkey script

You need to install autohotkey in order to use this: https://www.autohotkey.com/
Then create a new script (example: CohHotkeys.ahk) then paste below code and run the script.

Hotkeys are only made for wehr, pe and USA. I never play this utterly overpowered brits faction because I hate the non skill factor of it. So I never created hotkeys for it, but feel free to add them yourself in the script smile.gif

Hotkeys:
------------------------
Before starting a game make sure that you set the correct faction
------------------------
F9 = Wehr
F10 = PE
F11 = USA
F12 = Brits
------------------------
Build tier buildings
------------------------
F1 = Tier 1
F2 = Tier 2
F3 = Tier 3
F4 = Tier 4

F5 = Kampfkraft centre or Supply yard in case of allies
F6 = Heal station for allies
------------------------
For units
------------------------
r = fully reinforce squad (so you only have to press r once)
z = Build wire
x = Build sandbags
c = Build tanktraps
m = Lay mines (or teller mines in case of PE)
e = Build a bunker/emplacement (mg nest)
v = Build observation post
q = Attack move
------------------------
Global commands
------------------------
spacebar = Tactical map
w = Move up
a = Move left
s = Move down
d = Move right
CapsLock = Pauses autohotkey, to continue press CapsLock again

CODE

#NoEnv; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn; Enable warnings to assist with detecting common errors.
SendMode Input; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%; Ensures a consistent starting directory.

faction := ""

#IfWinActive, Company Of Heroes
; Set faction for correct keybindings before starting a game
;
; ! ! ! ! !
; Make sure that you have set the correct faction before the game starts!
; Just simply press
; F9 for wehrmacht
; F10 for Panzer Elite
; F11 for USA
; F12 for brits
; ! ! ! ! !
F9::
faction := "Wehrmacht"
return
F10::
faction := "Panzer Elite"
return
F11::
faction := "USA"
return
; I never play this stupidly overpowered faction, so no hotkeys have been made for it
; Create them yourself if you play brits and want to use hotkeys
F12::
faction := "Brits"
return
; When chatting autokotkey will be suspended, to make sure chatting is not a hell;)
Enter::
Suspend
Send {Enter}
return
; If hotkeys are not working, press i and check if faction is correct
i::
MsgBox, % "Current faction is " faction
return
Space::Numpad0
; Hotkeys to build tier buildings
; F5 for Tier 1
; F6 for Tier 2
; F7 for Tier 3
; F8 for Tier 4
;
; This overrides the default F1-F4 tier selection behaviour
; I find this no problem because the select tier buttons are already a fast way to select one of the tier buildings
F1::
if(faction = "Wehrmacht") {
    Send v
    Sleep 10
    Send w
}
if(faction = "Panzer Elite") {
    Send b
    Sleep 10
    Send l
}
if(faction = "USA") {
    Send v
    Sleep 10
    Send b
}
return
F2::
if(faction = "Wehrmacht") {
    Send v
    Sleep 10
    Send b
}
if(faction = "Panzer Elite") {
    Send b
    Sleep 10
    Send k
}
if(faction = "USA") {
    Send v
    Sleep 10
    Send w
}
return
F3::
if(faction = "Wehrmacht") {
    Send v
    Sleep 10
    Send s
}
if(faction = "Panzer Elite") {
    Send b
    Sleep 10
    Send j
}
if(faction = "USA") {
    Send v
    Sleep 10
    Send m
}
return
F4::
if(faction = "Wehrmacht") {
    Send v
    Sleep 10
    Send p
}
if(faction = "Panzer Elite") {
    Send b
    Sleep 10
    Send s
}
if(faction = "USA") {
    Send v
    Sleep 10
    Send t
}
return
; F5 and F6 are for special buildings
; F5 is the Supply yard or the Kampfkraft centre
; F6 is the USA heal station
F5::
Send v
Sleep 10
Send sk
return
F6::
Send v
Sleep 10
Send c
return
; Run r key multiple times to reinforce full squads
r::
Send rrrrr
return
; Builds a observation post
v::
Send b
Sleep 10
Send p
return
; z, x and c for Wire, Sandbags and Tanktraps
z::
Send b
Sleep 10
Send w
return
x::
Send b
Sleep 10
Send s
return
c::
Send b
Sleep 10
Send t
return
; m key to build mines
; Also works with PE's teller mines
m::
Send b
Sleep 10
Send m
return
; Build a bunker aka emplacement (engineers only)
e::
if(faction = "Wehrmacht") {
    Send b
    Sleep 10
    Send b
}
if(faction = "USA") {
    Send b
    Sleep 10
    Send e
}
return
q::a
a::Left
d::Right
w::Up
s::Down
CapsLock::Suspend


This post has been edited by redbullzuiper: Oct 13 2021, 16:01 PM

Posts: 151

Game: Company of Heroes


+

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)