AutoHotkey
From EU3 Wiki
For certain games like EU, Autohotkey (AHK) can be a real godsend. It lets you reprogram Windows and Windows apps to do almost anything.
Tired of reaching around for the pause key? Wish you had the advisor pool up all the time? Want to see the CoT ledger page sorted a certain way at the touch of a button?
Zero problem.
Example Script
You can do almost anything with any buttons of any input devices. This is just an EU-specific example.
With the following script:
- If your mouse has 5 buttons:
- Extra left mouse button = Pause toggle
- Extra right mouse button = Enter
- Scroll wheel (middle mouse) button = Current advisor pool (same as F3, below)
- Keyboard:
- F1 = the Domestic Interface (shield in upper left of EU), as always. (This is not an Autohotkey setting, but the rest are.)
- F2 = the Ledger, opened to most recent place (there is no key for the Ledger AFAIK - but AutoHotkey gives you one)
- F3 = the Domestic Interface opened to current advisor pool
- F4 = the Ledger, opened to the CoTs page, sorted by decreasing CoT value
- Control-Alt-Z = Turn on Country Mapmode, zoom down twice, and turn gamespeed to 2, when starting a (reloaded) game. Adjust to your prefs.
This is an example of how AHK can be used with EU. You can change it to anything you want - for EU or most any Windows program. Autohotkey lets you simplify repetitive tasks, just like "macros" in the old DOS days.
The below script could be saved as e.g. EU3.ahk on your desktop and double-clicked to redefine your inputs, just before starting EU3. Note: All Mousemove commands are dependent on the screen resolution you play EU3 in, but AHK includes a simple utility to detect where you click on things in AHK, so you can see and edit the script accordingly (the values shown are for 1280x1024 resolution). Semicolons denote Comments:
SingleInstance Force ; This unloads any previous version of this script and reloads the current one; useful for testing
XButton1:: ; Define action for the first extra button (on mice with two extra buttons)
Send, {Pause} ; Pause the game (same as hitting Pause). No more reaching across the keyboard
return ; End of action / subroutine for hitting XB1
XButton2:: ; Hitting your second extra button is now the same as hitting Enter
Send, {Enter} ; No more "hands across the keyboard" for this, either
return ; Tip: Hit XB1 and XB2 simultaneously when a single popup message occurs. See more notes on mice, below.
MButton:: ; This is the middle, or scroll-wheel, button. This script brings up the current advisor pool
Send, {Escape} ; The Escape key closes down many (but not all) open EU window panes
Sleep 100
MouseGetPos HereX, HereY ; Record current position of mouse pointer (so it can return to where you when script ends)
Sleep 100 ; "Sleep" commands are often needed to wait for the game to do something. 100 = 100 milliseconds
Mousemove 64, 65, 0 ; Move to position of Domestic Interface on the game screen. MOUSEMOVES DEPEND ON SCREEN RESOLUTION
Sleep 100 ; as stated above; these values are for 1280x1024 resolution
Click ; Previously, you moved to your DI shield. Now click on it.
Sleep 100
Mousemove 162, 121, 0 ; Move to Advisor tab
Sleep 100
Click
Sleep 100
Mousemove 101, 379, 0 ; Move to first advisor slot
Sleep 100
Click ; Click on first advisor - brings up free advisor list
Mousemove %HereX%, %HereY%, 0 ; Return your mouse pointer to wherever it was, so it appears to have stood still (see above)
return ; Tell AHK that this keystroke sequence is over. If you don't include this, AHK can get confused
;*** Bring up Ledger ***
F2:: ; Each hotkey definition starts with the key name followed by two colons
Sleep 100
Mousemove 1255, 857, 0 ; Move to Ledger button in lower right (DEPENDENT ON SCREEN REZ)
Sleep 100
Click ; Click it
Sleep 100
Mousemove 652, 263, 0 ; Move to center of screen. Or we could've used variables, as shown in previous hotkey script
return
;*** Bring up free agents list (same as middle mouse button, above) ***
F3::
Send, {Escape} ; An attempt to close some window panes that might be open. Doesn't work for all panes
Sleep 100
MouseGetPos HereX, HereY
Sleep 100
Mousemove 64, 65, 0 ; Moves to Domestic Interface
Sleep 100
Click
Sleep 100
Mousemove 162, 121, 0 ; Court/Crown/Advisor tab of D.I.
Sleep 100
Click
Sleep 100
Mousemove 101, 379, 0 ; Clicks on your topmost agent (to show free agents)
Sleep 100
Click
Mousemove %HereX%, %HereY%, 0 ; Return mouse to position it was in before you hit hotkey
return
;*** Bring up CoT list, sorted by decreasing CoT worth ***
F4::
Sleep 100
Mousemove 1255, 857, 0 ; click Ledger
Sleep 100
Click
Sleep 500
Mousemove 680, 238, 0 ; click Economy
Sleep 100
Click
Sleep 300
Loop 3 ; move 3 pages to right
{
Send, {Right}
Sleep 100
}
Mousemove 601, 300, 0 ; decreasing CoT value
Sleep 300
Click
Sleep 200
Mousemove 450, 507, 0 ; move near shields (to make it easier to send a merchant)
return
^!Z:: ; This sets up EU3 the way I like it after loading a savegame
Loop 3 ; Set gamespeed to 3
{
Sleep 200
Send, {NumpadAdd}
}
Sleep 100
Mousemove 732, 1007, 0 ; Move to Country mapmode
Sleep 100
Click
Mousemove 1256, 914, 0 ; Or was this Country mapmode? Damn I can't remember all the things I programmed
Sleep 100
Click
Mousemove 640, 514, 0 ; Return to center of screen
Sleep 100
Loop 5 ; This zooms in 5x via your mousewheel
{
Send, {WheelUp}
Sleep 100
}
return
^`:: ; Control-Tilde = Suspend AHK (a toggle). This lets you turn off all AHK if you, e.g., Alt-Tab out,
Suspend ; then want to surf e.g. the EU forums or wiki. Your extra mouse buttons return to being
return ; Backwards and Forwards, etc. Hit Control-Tilde to turn AHK back on.
Prepping page for public display - added it to Utilities but not Core_game_concepts yet, still got much more to write - got to run for the weekend - To be continued
- -RedKnight7 11:00, 28 June 2008 (CEST)

