CoolTerm Marcos using AutoHotKey
Posted: Mon Apr 23, 2018 3:10 pm
While CoolTerm doesn't currently support automation on platforms other than the Mac (using AppleScript), Windows users have a very handy and free automation environment at their disposal with https://www.autohotkey.com/.
An often requested feature for CoolTerm is the addition of transmit marcros allowing the user to send predefined strings of text via the click of a button or the press of a key on the keyboard. AutoHotKey supports this functionality very nicely, and its scripting language is very easy to learn. Here are a few examples of how CoolTerm can be automated with AutoHotKey:
Keyboard Macros:
The simplest way to send predefined text with CoolTerm is to use AutoHotKey to re-map certain keys on the keyboard. Here is an example:The script above repurposes the numeric keys 1 through 3 to send a certain text sequence. For example, when the "1" key is pressed on the keyboard, this script will send the keystrokes for "Macro Text 1" instead. The line #IfWinActive, ahk_exe CoolTerm.exe ensures that remapping only occurs when CoolTerm is the active application. In addition to mapping numeric keys 1 through 3, the script also remaps key 0 to terminate the script to provide an easy way to stop the script if needed.
GUI Macro Buttons:
For those who prefer a window with buttons to trigger certain transmit macros, AutoHotKey offers a solution as well:The script above creates a window with 3 push buttons, each of which tied to a different macro. Pressing any of the 3 buttons will first bring CoolTerm to the forground and then send the specified macro text. Closing the window with the buttons will terminate the script.
For more information on how to use AutoHotKey, refer to the documentation here: https://www.autohotkey.com/docs/AutoHotkey.htm
An often requested feature for CoolTerm is the addition of transmit marcros allowing the user to send predefined strings of text via the click of a button or the press of a key on the keyboard. AutoHotKey supports this functionality very nicely, and its scripting language is very easy to learn. Here are a few examples of how CoolTerm can be automated with AutoHotKey:
Keyboard Macros:
The simplest way to send predefined text with CoolTerm is to use AutoHotKey to re-map certain keys on the keyboard. Here is an example:
Code: Select all
#IfWinActive, ahk_exe CoolTerm.exe
1::Send Macro Text 1
2::Send Macro Text 2
3::Send Macro Text 3
0::ExitApp
GUI Macro Buttons:
For those who prefer a window with buttons to trigger certain transmit macros, AutoHotKey offers a solution as well:
Code: Select all
Gui, New, +AlwaysOnTop, CoolTerm Macros
Gui, Add, Button, gM1, Macro Button 1
Gui, Add, Button, gM2, Macro Button 2
Gui, Add, Button, gM3, Macro Button 3
Gui, Show
return
M1:
WinActivate, ahk_exe CoolTerm.exe
send Macro Text 1
return
M2:
WinActivate, ahk_exe CoolTerm.exe
send Macro Text 2
return
M3:
WinActivate, ahk_exe CoolTerm.exe
send Macro Text 2
return
GuiClose:
ExitApp