This is an application to generate AutoHotKey scripts to enable keyboard input of APL glyphs on Microsoft Windows.
AutoHotKey is an automation scripting software for Microsoft Windows. You can map keyboard shortcuts (or "hotkeys") to actions, including the output of characters. This program presents a form of options and generates an AutoHotKey script based on the user's choices.
AutoHotKey version 2 must be installed in order to use the scripts generated by APLAutoHotKey.
-
Download and install AutoHotKey v2
-
Download the latest release workspace, APLAutoHotKey.dws, from the releases page.
)LOAD
or double-click on the workspace file to launch the GUI application. -
Choose your locale/layout, shifting key, optional suspend shortcut and enter the path to the folder in which to save the resulting script. Then click the Generate Script button.
The script name will be based on the options provided and it will have a file extension of .ahk. For example,
APL-en_GB-CapsLockRCtrl.ahk
. -
Double click on or otherwise run the .ahk script file to start the script and enable APL keyboard input using your chosen options.
The following demonstrates how to use the API to generate scripts programmatically.
-
Import APLAutoHotKey:
]Get -u https://github.com/rikedyp/APLAutoHotKey/releases/download/v0.1.0/APLAutoHotKey.dws
]Get
can accept a local file path or the URL of a released .dws workspace -
Set options
opt←⎕NS'' opt.shift←'CapsLock' 'RAlt' opt.locale←'en_GB' opt.outfile←'/tmp/APL-en_GB-CapsLockAlt.ahk'
-
Generate and save the script
APLAutoHotKey.MakeScript opt ┌─┬──────────────────────────────────────────────────┐ │0│Saved: /tmp/APL-en_GB-CapsLockAlt.ahk (9404 bytes)│ └─┴──────────────────────────────────────────────────┘
-
Double click on or otherwise run the .ahk script file to start the script and enable APL keyboard input using your chosen options.
Each script is based on a single locale.
locale | code |
---|---|
English (UK) | en_GB |
English(US) | en_US |
Danish | da_DK |
Finnish (Finland) | fi_FI |
French (France) | fr_FR |
German (Germany) | de_DE |
Italian (Italy) | it_IT |
Spanish (Spain) | es_ES |
Swedish (Sweden) | sv_SE |
Other layouts can be supported on request, or generated by the user if they create the appropriate key map. See the
keymaps
folder for existing keymap tab separated values (.tsv) files.
This is a key which, while pressed, enables the input of APL glyphs. For example, Ctrl + e produces ∊
.
Available shifts are listed in the ahk_shifts
namespace.
APLAutoHotKey.ahk_shifts.⎕NL¯2
┌───┬────────┬────┬────┬─────┬────┬────┬─────┬────┐
│Alt│CapsLock│Ctrl│LAlt│LCtrl│LWin│RAlt│RCtrl│RWin│
└───┴────────┴────┴────┴─────┴────┴────┴─────┴────┘
The AltGr key sends a Left Control + Right Alt signal. Therefore, using the Alt (both), RAlt, Ctrl (both) or LCtrl shifting key options can affect the behaviour of the AltGr key.
The user may specify a key combination to toggle suspension of hotkeys, which may be useful if an application uses keyboard shortcuts with which the hotkeys interfere.
The script can be made to launch at startup by placing it into the user's startup folder or the common startup folder.
The startup folders on Microsoft Windows can be found by entering shell:startup
(this user) or shell:common startup
(all users) into the Run app (Win+R).
When generating a script, APLAutoHotKey checks the Microsoft Windows registry for installations of Dyalog Classic interpreters, and adds the paths to their executable files to the "Classic" group. When a Classic window is active, hotkeys suspend to allow the Classic application to handle keyboard input.
If a user installs a Dyalog Classic interpreter after generating a script with APLAutoHotKey, then they can either rebuild their script using APLAutoHotKey, or add the path to the executable file in an additional GroupAdd
line in their script.
This application is developed as a Cider project.
Open the project:
]CIDER.OpenProject /path/to/APLAutoHotKey
Build a new release workspace:
-
In a bash shell in the folder of this cloned repository:
./CI/Inject-Version.sh
-
In Dyalog
]DBuild APLAutoHotKey.dyalogbuild
Some keys do not immediately produce output when pressed, but will affect the next key press usually by adding an accent to a letter. These are known as "dead keys".
In AutoHotKey .ahk scripts, you may use a Unicode character directly to indicate it as a HotKey meaning that some action is taken when that character is output by the keyboard. For dead keys, you should use the scan code corresponding to that key.
To find the scan code for a particular key, start AutoHotKey by double-clicking any script file. A green "H" icon will appear in the system tray. Right click the system tray icon → click Open → click the View menu item and then click Key history and script info. Press the key and then press F5. The 2nd most recent key in the list should be the key you just pressed, and the 3-digit alphanumeric code in the 2nd column is the scan code.