5 AutoHotkey Scripts for Data Scientists

AutoHotkey v2 Scripts for Data Scientists: Five Windows Shortcuts That Remove the Boring Parts

What AutoHotkey Is and Where It Stops

AutoHotkey is a free, open-source automation utility for Windows. Its scripting language is built on one idea: a keyboard shortcut can run arbitrary code. That is the whole pitch, and it is enough to cover a surprising amount of desktop friction.

Three constraints shape everything below.

First, it is Windows-only. Equivalent jobs on macOS or Linux go to Hammerspoon, Keyboard Maestro, AutoKey, or a plain shell alias. None of these scripts transfer.

Second, this is v2, not v1. The v1 line is no longer maintained, but most existing forum answers were written in v1 and will not run under v2 unchanged. Start every file with #Requires AutoHotkey v2.0 so a version mismatch fails loudly at load time instead of misbehaving halfway through a paste.

Third, AutoHotkey is not a data tool. It moves windows and text around. The moment a script starts deciding what the data means, it has wandered out of its lane.

The Boundary Rule: Keep Hotkeys Out of Production

Here is the rule that keeps a toolkit like this useful. A script that types keystrokes into a production admin console is a liability with a hotkey, not automation. It has no audit trail, no dry run and no review. Keep it out of the toolkit entirely.

The same logic applies one step down from production. AutoHotkey is for desktop moments: launching things, reshaping clipboard contents, expanding frequently typed text, moving windows. It is the wrong tool for anything that must be reproducible. Transformations the analysis depends on belong in Python, R or SQL, in a file under version control, with a test. A clipboard trick that quietly reformats a join key is not automation; it is an undocumented preprocessing step that only exists on your machine. If a colleague reruns the pipeline without your hotkey loaded, the results should not change.

Script 1: Workspace Launcher

One hotkey opens Explorer, the editor, a terminal and a browser tab, all pointed at the project folder.

The workhorse is Run, which launches executables, folders and URLs alike. That uniformity is what makes the script short: one block can open a file manager window, an editor, a shell and a documentation tab without special-casing any of them.

#Requires AutoHotkey v2.0

ProjectDir := "C:workchurn-model"

#w:: {
    Run ProjectDir
    Run "code " ProjectDir
    Run "wt -d " ProjectDir
    Run "https://inferenceweekly.com/"
}

A note on trigger choice: #w (Win+W) collides with a common browser shortcut on some systems, so pick a combination your other tools leave alone and test it before you rely on it.

The gain over four taskbar shortcuts is that the bundle opens as a unit, in the right folder, and switching projects means changing one variable. Two cautions come with it. Keep machine-specific paths at the top of the file where the next person will actually find them. And never store credentials or API keys in the script. A script file is plain text that ends up in backups, shared drives and screenshot-adjacent chat threads.

Script 2: Clipboard-to-List Converter

This is the one people keep. Copy a column of IDs or category labels, press one hotkey, paste ['a', 'b', 'c'] for Python or IN ('a', 'b', 'c') for SQL.

The mechanism is A_Clipboard, which exposes the clipboard as text you can read and write like any variable. The function splits it on newlines, using "`r" as the omit parameter so carriage returns are dropped from the split, then trims surrounding whitespace from each value, quotes it and joins the results.

#Requires AutoHotkey v2.0

#!p:: {
    values := StrSplit(Trim(A_Clipboard), "`n", "`r")
    out := ""
    for v in values {
        v := Trim(v)
        if (v != "")
            out .= (out = "" ? "" : ", ") . "'" . v . "'"
    }
    SendText "[" . out . "]"
}

#!s:: {
    values := StrSplit(Trim(A_Clipboard), "`n", "`r")
    out := ""
    for v in values {
        v := Trim(v)
        if (v != "")
            out .= (out = "" ? "" : ", ") . "'" . v . "'"
    }
    SendText "IN (" . out . ")"
}

SendText pastes the result literally, so a bracket in the data is not interpreted as a keystroke. That distinction matters the first time an ID contains a character your keyboard layout treats specially.

The script does not escape embedded quotes. That rarely matters for a column of IDs, and when it does matter it is a sign the input has outgrown a hotkey. The reshaping here is deliberately temporary: it lives next to the clipboard and is gone once the paste is done.

The Clipboard Is a Privacy Surface

Customer IDs, tokens and query results sit in the clipboard temporarily. A script that reads it reads whatever happens to be there, which is not always what you copied five seconds ago.

Decide deliberately what a script logs and where it pastes. Formatter websites deserve particular suspicion: they are third parties receiving a column of identifiers they have no reason to see, and pasting a customer list into one is a data transfer, whatever the page’s privacy notice claims.

Once the reshaping is something the analysis depends on weekly, move it into the notebook or a small module beside the Python that does the real CSV processing, where it can be reviewed, tested and rerun. A list of 10 Python One-Liners for Cleaner, Faster AI Engineering Code is a reasonable home for a dedup or split that has earned its place, and a hotkey is not.

Three More Scripts Worth Writing Yourself

Scripts 1 and 2 above are complete and ready to paste. The remaining three are described rather than listed, because the exact code depends on your editor, your monitor layout and your file paths. Treat them as patterns to adapt.

Analysis hotstrings. Hotstrings expand an abbreviation into longer text as you type, which is the right shape for the boilerplate that opens every notebook or query: the import block, the connection string skeleton, the standard plotting setup. The syntax is a trigger wrapped in colons, so ::imp:: followed by the import block on the next line will expand whenever you type imp and press a terminator. Where the clipboard converter is a one-shot gesture, a hotstring is a typing habit. Keep expansions short, keep them current, and do not let a hotstring become the only place a critical query exists.

Path formatter. This takes a file path copied out of Explorer, backslashes and all, and hands back something a notebook can read without a manual find-and-replace pass. It is a small thing that happens dozens of times a week. The core is a string replacement on A_Clipboard, swapping for / before you paste.

Window layout hotkey. This snaps windows into place: editor on one half, terminal and browser on the other. AutoHotkey’s window management commands handle the positioning. Monitor configurations differ, so pin coordinates per machine rather than assuming a layout. Neither this script nor the path formatter is glamorous. Both remove a decision from the day.

Reference Table: What Each Script Does

Script Desktop chore it takes over AutoHotkey feature doing the work First thing to watch
Workspace launcher Opening Explorer, editor, terminal and a browser tab in the project folder Run, which handles executables, folders and URLs alike Machine-specific paths at the top; no credentials in the file
Clipboard-to-list converter Turning a copied column into ['a', 'b', 'c'] or IN ('a', 'b', 'c') A_Clipboard plus SendText for literal pasting Values containing quotes need escaping the script does not do
Analysis hotstrings Expanding notebook and query boilerplate as you type Hotstring triggers Keep expansions short and current; do not let one become the only copy
Path formatter Stripping backslashes from a path copied out of Explorer String replacement on A_Clipboard Windows-only path syntax; check before pasting into cross-platform code
Window layout hotkey Snapping windows into a working arrangement Window management commands Monitor configurations differ; pin coordinates per machine

Feature names and command behavior reflect the AutoHotkey v2 documentation; the “first thing to watch” column is this article’s own advice.

Small Scripts, Clear Boundaries

The value of a toolkit like this is not that it saves a few keystrokes. It is that the keystrokes it saves are the ones with no analytical content, and the boundary around them is explicit.

Keep the hotkeys for the moments around the work. Keep the work itself in version control, in Python, R or SQL, with a test. Keep secrets out of the script file. That division is what makes the toolkit useful instead of fragile. The enterprise data science stack has long faced cost pressure, and the linked InferenceWeekly article on free AI tools replacing costly data science software covers how that pressure is reshaping what teams actually run. AutoHotkey sits at the cheap, unglamorous end of that shift, doing one job on one platform.

Write the launcher today. Write the clipboard converter tomorrow. Then stop, and put everything that matters somewhere you can review it.

Similar Posts