Specific ways to reproduce these AutoHotkey scripts on macOS (a repost of my comment on Lobsters):

## AutoHotkey equivalent

The closest equivalent to AutoHotkey in general is Keyboard Maestro (https://www.keyboardmaestro.com/, currently $36), a proprietary app. In Keyboard Maestro, you define macros using a drag-and-drop scripting language. You can also embed shell scripts or AppleScript. Each macro can have a number of triggers, most commonly Hot Key triggers.

## (Keyboard and) mouse shortcuts

Keyboard Maestro’s triggers can associate custom shortcuts with your macros. Most of my macros have Hot Key triggers, which capture to keyboard shortcuts. For example, Shift+Ctrl+S triggers a macro that puts my laptop screen to sleep.

However, to respond to a mouse input like Scroll Wheel Left, you would have to use a Device Key trigger. A Device Key trigger responds to a single device input, but sadly, it doesn’t block the input from being passed to the OS. In this example, whatever your cursor is over would scroll left in addition to the macro being activated.

To replicate the `Send, {NumpadAdd}` part of your script, you would add a Type a Keystroke block to your macro. One nice thing about KeyboardMaestro is it can record the keystroke, so you don’t have to remember names like “NumpadAdd”.

If you don’t want to buy Keyboard Maestro, macOS’s built-in Automator (https://support.apple.com/en-ca/guide/automator/welcome/mac, free) can be used in some cases. For examples, compare three of the solutions on https://apple.stackexchange.com/questions/137047/ for working around bad default ⌘C behavior in Books: my simple Keyboard Maestro solution, someone’s straightforward Automator solution, and my shorter, situation-specific Automator solution.

## Hotstrings for math

I used to use TextExpander ([TextExpander]: https://textexpander.com/, currently $40/year) for something like this. I had `ddate` mapped to the current date, and `solang` marked to a block of markup I used on Stack Overflow. TextExpander implements the direct equivalent to AutoHotkey hotstrings, and is probably the best way to implement short hotstrings like `;a`.

However, for my purposes, I realized that I could insert pieces of text more simply by using another program I was already using: LaunchBar (https://obdev.at/products/launchbar/, currently $30). While its most obvious feature is launching applications, one of its many other features is inserting text snippets. You define text snippets by putting text files in a certain folder. Your defined snippets are then added to your global list of searcheable items, alongside applications you can open and so on.

To insert a snippet such as the current date using LaunchBar, I open a LaunchBar window with Command-Space, type `date` to find the “Current Date (ISO format)” snippet, and press Return to insert it.

Also note that macOS makes typing special characters easier in general. All macOS keyboard layouts let you access an alternate layer of characters by holding Option. For example, Option-8 types ‘•’. If you would rather Option-A typed ‘∀’ instead of ‘å’, you could set that up by defining a custom math-focused keyboard layout with Ukelele (https://software.sil.org/ukelele/, free). I have used Ukelele to define my own keyboard layout “U.S. – Rory custom” that makes smart quotes and apostrophes (“”‘’) easier to type.

## Markdown links

You could do this with Keyboard Maestro. It has actions for reading from and writing to the clipboard, and for appending to, prepending to, and searching and replacing in text variables.

Just a few days ago I implemented a Vim editor mapping to do a similar thing: turn the selected text into a link with the clipboard used as the URL. Of course, it only works in Vim. Here’s the source:

" create Markdown link from selected text using URL in clipboard
" uses vim-surround, so can’t be vnoremap
vmap <Leader>ml s]%a()<Esc>"*Pl

## Fast Window Switching

I used to have something set up for this. I used Karabiner (formerly KeyRemap4MacBook) to map my fn key to the combination of Shift-Control-Option-Command. Then, with Keyboard Maestro, I mapped ⇧⌃⌥⌘F to open the Finder and so on. That let me type fn+F to switch directly to the Finder.

Karabiner was forced to be rewritten as Karabiner-Elements (https://karabiner-elements.pqrs.org/, free and open source) because of changes in macOS, and it lost some features in the process. I haven’t checked if mapping of fn is one of them. I don’t use Karabiner-Elements because I rarely used my fn mappings and my current model of laptop doesn’t have real function keys to remap.

As for window groups to switch within, Keyboard Maestro doesn’t have a built-in concept like that. I think you could implement it, though – “if” statements can check the app of the current window.

## Remapping the calculator button

This would be a straightforward application of Keyboard Maestro.

## Scihubize

Same as above.

---

That covers everything in your article as much as macOS software is capable of. You may also be interested in…

## Features I use without equivalents in this article

Keyboard Maestro lets you define a Quick Macro – a sequence of keypresses and clicks. I can press Ctrl-F1 to start recording, execute a sequence, then press Ctrl-F1 to stop recording. After that, Option-F1 will run the sequence. I use this, for example, in my browser to scroll many adjacent newly-opened tabs down to the start of the content, by recording and replaying the sequence Ctrl-Tab, Down, Down, Down, etc.

Keyboard Maestro also supports image recognition for clicking on the screenshotted GUI element or waiting for something to appear on the screen. I’ve used this to make a macro that uses the System Preferences GUI to toggle a setting – it decides whether to move the selection up or down by recognizing the image of the currently-selected preference. I’ve also used it to abort a macro if I don’t see the expected window open after a certain step (which could happen if the GUI was in a certain state), to avoid executing further keypresses in the wrong window.

LaunchBar comes with a built-in clipboard history manager. I use this to copy, for example, both a title and URL in one window, knowing they will be saved. Then, after switching to another window, I use the clipboard history to paste both of them where they need to go.