This is a great tool I use all the time. In addition to about 2 dozen hotstrings, I have a script that will automatically open my email editor, a script that will open my calendar to allow me to schedule a meeting, and a script that will open a new message in Slack to allow me to quickly fire off a message.
On macOS a similar tool is Keyboard Maestro (https://www.keyboardmaestro.com/main/). I made over 1400+ macros in it over time that automate practically everything for me now.
Would love to have a bunch of macros, but I honestly have a hard time imagining the 1400+ situations that are worth automating? Could you maybe provide some obscure examples of yours? That would be pretty cool.
I'm not quite at 1400 (yet!) but I truly depend on it... a fresh install of macOS feels broken without it. Even better when combined with Karabiner, as you too suggest.
A thousand times, this. I love AHK. It, along with Ditto Clipboard Manager (Yes, I know W10 has its own. It sucks) changes my workflow so much for the better. Some of my favorite examples:
Right Alt becomes Ctrl Tab:
Ralt::^Tab
Common typos:
::teh::the
::alreadsy::already
::nopity::Call to undefined function pity()
::awk1::awk '{{} print $1 {}}'
::du-m::du -m --max-depth=1 | sort -n
But it goes waaay behond this. I once used AHK to assist my grandfather, who in his old age had caused him to lose dexterity. He was clicking both right and left mouse buttons at the same time. I used AHK to disable the might mouse button and then mapped right click to Number Pad +. Worked beautifully.
I'm a bit masochistic when it comes to typos. This is from my AHK script:
:*:netowrk::
Send, {Home}+{End}{Delete}
return
What it does: I have a really bad habit of misspelling "network" that way. I think my right hand is just so eager to get that 'o' keyed in that it doesn't wait for my left hand to hit the 'w' first. So I'm always screwing that word up when typing quickly.
So now, when I make that mistake, I'm punished by having the entire line of text deleted. '{Home}' moves the cursor to the start of the line, '+{End}' is the [Shift]+[End] key to highlight the whole thing, then {Delete} metes out the justice I deserve.
> add a system-modal popup that requires you to type in "network" correctly 50 times in a row and then issues a Ctrl+Z; if you make a mistake, you start over.
Working on it. And to make sure I don’t cheat, it’ll put me into a kiosk mode and temporarily change my password to prevent me from escaping my punishment.
I recently wrote a script that I call with Meta+F, assigned via a Linux Mint keyboard shortcut. It will open Firefox, or focus it if it's already open. Multiple presses will cycle through open instances. Meta+T does the same for terminals. It's like a focused version of Alt+Tabbing through programs.
Linux users, see https://github.com/autokey/autokey . I use it for purposes very similar to those described by the article (little automation scripts, text expansion).
It's equally as {sometimes awesome, sometimes infuriatingly quirky} as its Windows inspiration :D , but I guess it's the nature of such a tool :) .
Unfortunately, AutoKey is not similar to AutoHotkey. I tries to be, but fails so far.
Lacks a loooot of AHK functionality and contains lots of bugs.
The development is so slow that something new after Linux will come out sooner than they reach AHK's state of, say, 2010.
For much more limited uses, which still covers a lot of what I care about, there's xdotool. A major difference is that xdotool just creates input events, but doesn't hook triggers; I just use my window manager for that.
Yup. wmctrl too; sometimes one is more friendly for the specific thing you need done, sometimes it's the other way.
Passersby, warning, both are Xorg-only. For wayland, see https://github.com/ReimuNotMoe/ydotool but the naming is confusing, as it doesn't work exactly at the same level: ydotool is about keystrokes, not window management.
AutoIt ( I know this is about AHK but hear me out) was my first actual coding language. this was way back in 2008 when I was a manual tester and I decided to work on an automation framework around testing our .net based app. the documentation was amazing. the language are incredibly simple. and the windows integration was insane.
In a way, if I hadn't worked on the automation framework using autoit, i probably wouldn't have decided to learn python, js and other languages and really wouldn't be where I am.
I believe AHK was an early fork of AutoIt. AutoIt was my first language as well. A fun language to write code in. No static typing, easy to use. A little code can do a whole lot. I miss the forums, I wonder what ever happened to everybody there, Gary Valik Validator Larz SmokeN -- some names that come to mind. To think of all the devs that used this language as a stepping stone in their careers. Incredible. Hats off to Jon & Team!
The odd thing about that video is that Tom claims he uses Windows because 1) it is cheaper, and 2) it allows him to "bodge" (aka create quick hacks). And he explicitly dismissed Linux.
But his example, creating an emoji keyboard, would be far easier with Linux. And Linux is cheaper (in terms of money, not necessarily time). Someone in the YouTube comments actually posted how to do it in Linux, which is basically:
xinput list
xkbcomp $DISPLAY mapping.xkb
vim mapping.xkb
xkbcomp -i <id from xinput> mapping.xkb $DISPLAY
I heavily use AHK to make my Windows 10 an enjoyable and keyboard focused environment. Between AHK and an hardware keyboard with full keyboard macro's, I have Windows working with my Macintosh inspired keyboard bindings.
Of course on the Mac, I heavily use Keyboard Maestro and LaunchBar so I am really implementing my own keyboard centric UI
Do you use one? Which? I used one, very convenient, in eighties(!) and haven't seen something comparable since.
The functionality I had then that I liked was: any key could be programmed to really anything else (except the special "macro" key) -- another key or another sequence of the keys, and I regularly did some action once, recording it with just one "start recording" and one "stop and assign to.." action and after that just "playing" it when needed. It was a huge time / nerves saver at these times, especially because it was fully independent of the programs and even of which OS I've used (I've had to switch between two even then).
I'm not the parent, but I use the Kinesis Advantage and it supports macros. Basically you can rebind any key to any other and also bind any key to a sequence of other keys. I think you can also change the timing of each key press, but I've never used that feature.
AutoHotKey was my first programming language, years and years ago on my couple hundred dollar laptop. It wasn't much, but it was definitely a great introduction to basic CS concepts (if statements, loops, functions, etc.).
I remember using it to automate login for a variety of websites, and to automate resource collection for a game I played (Lord of Ultima, in case anyone remembers it).
Here's what we really need - a tool that monitors the various user actions like specific application functionality used, website actions taken, and maybe keystrokes too (but that gets dicey), and then every month or so it recommends the most frequently done actions that you should automate with AHK or some other tool. What does the community think of this?
PS - I use Alfred and Keyboard Maestro to get functionality similar to AHK on a Mac.
I might be misremembering, but I think there was a package for Emacs that would track the most frequently used M-x commands, so that you could later look at the list and see which ones are worth binding to a key. I can't for the love of me find it now.
theres a function somebody wrote (acc.ahk) that can detect elements and text in a lot of windows programs. it can click things like the "add to library" button in spotify even when the window is minimised
there is the COM object that detect the same sort of things but in web browsers, but it only works in IE only. for firefox or chrome you would need to use selenium.
maybe these things can detect certain things being clicked as well? i dont know
I've started[1] to do similar things on macOS using Hammerspoon[2]. So far I've set it up to let me:
1. Use shift when pasting something to simulate typing in the text instead, getting around websites that block pasting.
2. Use ";" as a hyper key. By holding it down and pressing another key, I can switch between specific programs without cycling. I can also use hjkl as arrow keys.
3. Automatically switch audio input and output devices according to my specified priority order. Because macOS would frequently get it wrong, including treating my monitor as a speaker for some reason (it doesn't have built-in speakers).
4. Make control act as escape when tapped. I use this in conjunction with remapping caps lock to control in macOS system preferences. I previously used Karabiner Elements for making caps lock work as escape when tapped and control when held, but I was able to uninstall Karabiner because Hammerspoon was sufficient.
5. Disable the insert key because I've never wanted its functionality, but I would sometimes hit it accidentally.
The usage of ; as a hyper key is fascinating. This is the first time I've seen someone do something with Hammerspoon that's actually tempting me to try it out.
For paste blockers I've been using an Alfred workflow that types keys using AppleScript. It doesn't work with characters that require special input like ü, which is annoying, but it's sufficient for passwords. The benefit here is I'm not using up a global hotkey for such an infrequent use-case (especially not one actually used by other apps, such as Terminal.app).
Man as someone who has been putting off the upgrade that's too bad, I figured their solution of creating kind of a virtual keyboard input would be pretty solid going forward.
Does Hammerspoon work just as well? Karabiner is so incredibly solid.
Hammerspoon is doing the stuff talked about here using event taps. I don't know if you can reliably use event taps to simulate different modifiers though, or to prevent a modifier from actually taking effect (e.g. if you wanted to remap one modifier to another).
I'm hoping Karabiner Elements figures out some solution going forward. It still works on Catalina but the expectation is the "legacy kext" will no longer function on 10.16.
Using ; as a hyper key blew my mind, like the article recently about how a certain developer calls all of his scripts ',something' so if he want to run a cli command of his, pressing comma then tab will show only his scripts, so ',py(tab)' won't have 15 pythons in it.
I had almost used up all combinations of Ctrl, Alt, Shift, Win and letters at one point, and still never thought of making my own hyper key. It's genius.
At my new job I'm afraid to download AHK at all :(
I happily used Karabiner for years but only to handle my caps lock remapping. It's not bad. I just generally like having as few dependencies as possible. I definitely needed Hammerspoon for other stuff, so if it can cover my one use case for Karabiner as well, then I only need to use one program instead of two.
One specific reason I want to go with Hammerspoon in the long run for key remapping is that I plan to do more complicated things, like setting up key layers. And even if that's possible with Karabiner, I'd rather maintain the complexity with Lua code rather than Karabiner's JSON configuration, which is complicated enough that someone created a separate tool[1] just to generate the configuration.
I should note that one of the maintainers of Hammerspoon specifically recommended[2] using Karabiner instead of Hammerspoon for key remapping because Karabiner was built to do that. Hammerspoon has a much higher level view of key events, from what I understand. I don't plan to do any remapping with modifier keys though. I plan to only use the letter keys for everything. Something like: press and hold ;, then press and hold v, and then tap a. And that will re-arrange my current windows into my preferred arrangement. Stuff like that. Based on my initial experience, I should be able to do everything with just Hammerspoon.
> including treating my monitor as a speaker for some reason (it doesn't have built-in speakers).
This is quite common on HDMI monitors. Since the HDMI connection transmits both audio and video, the monitor just accepts both audio and video input. They would then have a 3.5-mm jack to allow you plug in an actual speaker or headphone to receive the audio output.
Which is something I don't understand, just separate the signal and give me a digital output from the monitor, why are monitors doing digital analog conversion for audio too, all of a sudden?
It was useful for me when I hooked my nephew's Nintendo Switch up to my computer monitor to let him play and then connected desktop speakers straight to the monitor.
There are usually different flavors of the same base-model. Some have speakers, other not. Not adding speakers, but leaving the rest ist just cheaper and more reliable than tinkering with every flavor for single features.
When I had a work-Mac I used Keyboard Maestro for stuff similar to this. It can do stuff based on a variety of input events; I had it do "location-y" stuff for me upon wake so it would do different things based on if it woke at the office or at my house, for example.
This one really drives me mad. Is there really any legit reason to this?
By the way my hack is I paste it in the address bar, then just drag-drop into the field. Works 50% of the time or more (fails when a lot of these stupid websites don't use placeholder attribute but rather use some sort of Javascript for the placeholder text)
> This one really drives me mad. Is there really any legit reason to this?
No. Which is why I set the about:config option "dom.event.clipboardevents.enabled" in Firefox to false. That turns off the ability of websites to block pasting in Firefox.
Oooh, neat! Thanks! I presume it would also defeat those idiotic "let's insert a backlink or an ad into the text you just copied" scripts.
Truly, there are very few legitimate reasons for a site to even know you've copied or pasted something. Makes me think this setting should be a whitelist.
Having used both Hammerspoon and AHK, the latter is somehow both terser and more ergonomic. I miss it dearly when I'm not on Windows.
And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps lock, really?
I've actually gone kind of crazy with this idea and made my left ctrl, shift and alt behave as fn+ctrl, fn+shift and fn+alt, so that e.g. left ctrl+h actually does ctrl+left. Then I made fn+[ = pgup, fn+] = pgdn, fn+; = home, fn+' = end and fn+\ = delete, with the same augmented fn+LHS modifiers.
Took me about a week for the muscle memory to catch up and allow me to correctly hit ctrl+L with the right hand when I want to go to the address bar, but now I'm ridiculously fast moving around in Excel without having to touch the arrow keys.
Only downside is I have a relatively problematic left wrist and this set up added to the already LHS stress to the already very imbalanced qwerty layout, so it forced me off mechanical keyboards to a low profile logitech right around the time COVID-19 hit.
You can use Quick Actions (formerly Services) to trigger Mac automations, with customized Keyboard Shortcuts and text input replacements but it’s all scattered across a dozen apps and it’s kind of clunky to piece a workflow together from all these parts. But if you know the ins and outs, there’s a lot you can accomplish from a Mac, particularly as macOS has historically had better app support for AppleScript and somewhat better accessibility tooling. http://www.macosxautomation.com/automator/services/extension...
Recent attempts to lock down the system point to how it’s “not the default” to customize your Mac outside the App Store. And I find the share sheet is still more useful on iOS than on macOS (for now?) just as Finder is more useful on macOS than Files app is on iOS.
That said, Windows Terminal and WSL highlight that Microsoft isn’t slowing down here and Apple might actually need to play catch-up at some point and evaluate new approaches to developer and power user pain points. (AppleCare-supported upgradable storage is on my wish list but that’s not technically the software’s fault... just a policy Apple used to have and then later removed from their website as they moved to proprietary SSD controllers)
> And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps lock, really?
Caps Lock is quite useful, because it's the perfect location for remapping the Ctrl- and ESC-Keys. Which is no surprise, as they originally where located there.
Under linux there is a nice tool for overloading keys, so they behave one way when pressed short, and another way when holded longer. With programmable keyboards you even have it OS-independant.
I use https://github.com/alols/xcape for some while now. It's old, reliable and straight forward, just does it's job. Only downside is that it seems to be limted to X11. Not sure how well it will play with wayland.
There are now also some alternative tools, with more ability, which allow overloading just on the side. I have them on my list for a while now, but not done much yet with them.
For Excel on Microsoft Windows, there is vim_ahk [1] to add Vim key bindings (after adding EXCEL.EXE to VimGroup) using AutoHotKey.
For LibreOffice, especially its spreadsheet calculator Calc, there is the vibreoffice [2] extension.
Why macos doesn't offer something like this by default is beyond me.
Really, there are some really smart people at apple. You know some of them have customized their environment. You know apple has internal tools.
Why don't they get it and support customization of their os?
They're also not very supportive of "outside" tools. Say you want to use python on macos. Apple has only the most passing support for it. Same with bash or anything else that could put up a dialog box or whatever without having to compile/use xcode/other barrier to entry.
applescript doesn't count.
I know you can add software like macports or homebrew, but I mean first class support from apple.
> 2. Use ";" as a hyper key. By holding it down and pressing another key, I can switch between specific programs without cycling. I can also use hjkl as arrow keys.
Did you overload the ;-key, meaning it sends ; when pressed fast, and acts as modifier when hold and pressed with other keys? Is'nt that kidna painful to use and inflicts false input occasionaly?
I too have some personal modifier-keys. I remaped Pause-key to the Right alt-key, and use for persional settings in apps. And I remapped the left Alt-key to F22, and use it for window managing and staring/raising apps.
Benefit with this is that both keys are exclusively used by me and the pause-key is also available even when my setting is not available.
That's correct, but I've never gotten false input before. If my setup gave me false input even 0.5% of the time, I wouldn't use it at all. I give myself 250 milliseconds to release the ; key to type it as normal, and that has worked fine for me, both on my laptop keyboard and on my external keyboard.
I find it very easy to use since my pinky finger sits on the ; key by default.
Although really intreaged to finally find some really good use for Hyperspoon something in that script didn't work.
pressing ; and releasing it kept the hyper active so if you pressed some trigger key it triggered it instead of doing the input. Also pressing ; repeated did of course nothing.
Wished there would be a better way to actually map hyper key that only is activated if pressed down. Well, I went back to BTT and setup fn + and this works too.
I've used AHK a fair bit, and while it's quite helpful I can't help but want for a better syntax and less limited core language. I think it would do much better as a lisp with more obviously defined syntax boundaries.
The hotstrings feature is also present in Linux, where they are known as compose sequences. The default compose sequences can be found in the Compose files under /usr/share/X11/locale and you can also have custom compose sequences in ~/.XCompose. Some of the compose sequences make use of a special Compose key (written <Multi_key> in the rules). You may need to go to the keyboard settings to enable the compose key.
Edit: by the way, these compose sequences also work under Wayland. The only hiccup I found with wayland was that include directives didn't work so I had to put everything in a single file.
I've bound my Caps Lock to Compose, it's really quite handy.
I wish there were a Unicode lookup utility app that would display a character's compose sequences if any, but none seem to be under development / accepting feature requests or patches.
And on Windows you can use WinCompose to get all the normal compose key sequences and more, plus you can add your own in with ~/.XCompose.
I love my Compose key. When I looked into purchasing a Surface Book (and switching to Windows) some four years ago based purely on its specs, the two critical factors were WSL and WinCompose—without either one of those two, I couldn’t have, wouldn’t have switched.
(I also use an AutoHotkey script for a few other things like remapping Win+F to maximise/restore, and disabling the horrifically slow Win+Tab which was too easily triggered by accident.)
Being too cheap to rent a photo booth for our wedding I used AutoHotKey to glue a software to control my (then) fiancees Nikon and Irfanview together. The software ran on my Laptop, the camera was connected via USB.
I've started programming using Autohotkey,
I just wanted a script for age of empire 2 to manage where catapult can efficiency dispatch attacks.
After that I made a bot that can auto fold poker hands, it worked, with AHK you can search image on the screen and get position of the matched image.
After that I made a fully functional and autonomous poker bot
many years later I am now a software engineer, I just wanted to manage my catapult on Age of empire 2 ....
So AHK is very powerfull, easy langage and awesome !
Yeah. I think it's also a perfect example of scope creep done right. As I understand, its original purpose was closer to remapping Caps Lock to CTRL, not to let you write a whole tiling window manager[0] for Windows in it. But now it can do both, and established itself as the unofficial Windows scripting language.
Oh man, I am using (abusing?) AHK so hard. I work with legacy software programs for structural analysis, where everything in the model has to be input with clunky form fields. Thousands of properties need to be defined for various structural components (beams, columns, etc). It used to be >2 weeks of entering numbers into fields and clicking buttons.
Now, AHK is set up to just reads my design spreadsheets and define everything in a few minutes. I hate the language syntax, but man is it useful! God bless AHK!
I absolutely love AutoHotKey. I've been using it for over 15 years. I used to use it to format my HTML back when i only used a Text Editor (similar to what this link is using for Markdown. I never use my right-control key so I map a lot of stuff to it. I used to have macros on rightctrl+b = surround the selection with <b></b> and later <strong></strong> (yes, it was that long ago). I had some nifty ones with logic for adding <a>s (looking for @ and http://).
These days I use it for fewer things, but still really useful. One of those is making chat applications that don't offer ctrl+enter to send a message - Like Google Hangouts (basically flopping the functionality):
#IfWinActive Google Hangouts ahk_class Chrome_WidgetWin_1
Another extremely useful is this one, which will type what's on the clipboard rather than pasting it:
>^v::
SendRaw %clipboard%
Return
And when I hit shift also, it does it slow (for input lag situations):
>^+v::
SetKeyDelay 500
SendRaw %clipboard%
Return
Extremely useful for two main reasons. 1 being input boxes on websites that prevent pasting and 2. certain remote sessions that prevent pasting (like Kesaya or any kind of Console remote application).
If you mean "why do they prevent pasting?" -- because their talented and conscientious devs think password managers are insecure. I've tried emailing several webmasters about this but it's a waste of time.
A common one I see is when you're entering in bank account information and they force you to retype the account and/or routing number, even though you never typed it in to begin with because you just copy-pasted it from your bank's website :/
The worst is the banks that don’t let you copy it...
I don’t understand this insanity around bank account numbers... they should be treated as public info, they’re on every single check, anyone you’ve given a check to has your account number as does your employer...
It's an easy way to feel smart? I had to put up a fuss about this and cite NIST.
My bank tried to do this, but it only works on the username field in chrome?
For a really stupid example, part of my job involves originating truck shipments. One carrier we use has a website that prevents pasting on their web form to generate a bill of lading. Because forcing me to type in an address is much less likely to cause errors than pasting in whatever address I had copied.
Funnily enough (in a sad way), 40% of the JS load on that page appears to be anti-pasting logic & supporting libraries. It appears to be developed in-house, since the scripts aren't obfuscated and a quick search of duckduckgo didn't match any open-source libraries that I could find. If they weren't reliably the cheapest carrier with the fewest issues I would raise a stink, but it's not worth it. That, and I just bypassed this 'feature' with a very similar AHK script, and their website has a very nice UI besides that issue.
AutoHotKey scripts gets me some pretty insane lee-sin ward-hops so yeah its a pretty awesome tool.
You can mess with league of legends folks a lot with it actually. You can use it to spam 5 pings around someone instantly. You can spam emotes with it. You can write messages quickly in chat.
My company is trying to solve similar challenges for automating common typing tasks on web pages (email, chat, CRM, etc...) with our Chrome Extension Text Blaze [1].
It was a pretty extensive formula support [2] enabling you to create dynamic snippets. In many ways it's kind of like Excel but for documents.
218 comments
[ 0.20 ms ] story [ 101 ms ] threadHuge time saver!
https://wiki.nikitavoloboev.xyz/macos/macos-apps/keyboard-ma...
PS: great site!
I often use Siri on my iPhone to write messages, etc. It’s pretty good but at times frustrating.
How does Dragon on Windows compare? I like the tablet form factor. Does Dragon work well on a Surface Go?
Right Alt becomes Ctrl Tab: Ralt::^Tab
Common typos: ::teh::the ::alreadsy::already
::nopity::Call to undefined function pity()
::awk1::awk '{{} print $1 {}}'
::du-m::du -m --max-depth=1 | sort -n
But it goes waaay behond this. I once used AHK to assist my grandfather, who in his old age had caused him to lose dexterity. He was clicking both right and left mouse buttons at the same time. I used AHK to disable the might mouse button and then mapped right click to Number Pad +. Worked beautifully.
I actually wrote a Big Long Article about it once: https://www.tidbitsfortechs.com/2013/10/using-autohotkey-to-...
So now, when I make that mistake, I'm punished by having the entire line of text deleted. '{Home}' moves the cursor to the start of the line, '+{End}' is the [Shift]+[End] key to highlight the whole thing, then {Delete} metes out the justice I deserve.
There, fixed :).
It’ll be like my very own ransomware!
It's equally as {sometimes awesome, sometimes infuriatingly quirky} as its Windows inspiration :D , but I guess it's the nature of such a tool :) .
Won't work (yet?) on Wayland, though, https://github.com/autokey/autokey/issues/87 .
Instead, I derived my own little shell script snippy.sh [1] that expands a fuzzy selected string by letting xdotool type it out.
[1] https://github.com/konfekt/snippy.sh
Passersby, warning, both are Xorg-only. For wayland, see https://github.com/ReimuNotMoe/ydotool but the naming is confusing, as it doesn't work exactly at the same level: ydotool is about keystrokes, not window management.
https://espanso.org/
So, much love to the AHK/Autoit team.
All the buttons, TVs, lighting effects... all run from windows PCs with AutoIt!
(there was a flash photo gallery, because 2007, but here are some of the images)
https://www.etc.cmu.edu/projects/lbe/S07/clients/ETC/gallery... https://www.etc.cmu.edu/projects/lbe/S07/clients/ETC/gallery...
I first found out about AHK via Tom Scott's similar ode here:
https://www.youtube.com/watch?v=lIFE7h3m40U
He describes it as “a bodge that helps you make other bodges”, which is beautifully put.
[For those outside the UK, a “bodge” is a clumsy hack or repair.]
The video also reminded me to let some of the young guns in my team into the AHK secret
But his example, creating an emoji keyboard, would be far easier with Linux. And Linux is cheaper (in terms of money, not necessarily time). Someone in the YouTube comments actually posted how to do it in Linux, which is basically:
Of course on the Mac, I heavily use Keyboard Maestro and LaunchBar so I am really implementing my own keyboard centric UI
Do you use one? Which? I used one, very convenient, in eighties(!) and haven't seen something comparable since.
The functionality I had then that I liked was: any key could be programmed to really anything else (except the special "macro" key) -- another key or another sequence of the keys, and I regularly did some action once, recording it with just one "start recording" and one "stop and assign to.." action and after that just "playing" it when needed. It was a huge time / nerves saver at these times, especially because it was fully independent of the programs and even of which OS I've used (I've had to switch between two even then).
I remember using it to automate login for a variety of websites, and to automate resource collection for a game I played (Lord of Ultima, in case anyone remembers it).
PS - I use Alfred and Keyboard Maestro to get functionality similar to AHK on a Mac.
We recommend that you just park it in a corner of your screen and turn on an auto-reload tool.
there is the COM object that detect the same sort of things but in web browsers, but it only works in IE only. for firefox or chrome you would need to use selenium.
maybe these things can detect certain things being clicked as well? i dont know
1. Use shift when pasting something to simulate typing in the text instead, getting around websites that block pasting.
2. Use ";" as a hyper key. By holding it down and pressing another key, I can switch between specific programs without cycling. I can also use hjkl as arrow keys.
3. Automatically switch audio input and output devices according to my specified priority order. Because macOS would frequently get it wrong, including treating my monitor as a speaker for some reason (it doesn't have built-in speakers).
4. Make control act as escape when tapped. I use this in conjunction with remapping caps lock to control in macOS system preferences. I previously used Karabiner Elements for making caps lock work as escape when tapped and control when held, but I was able to uninstall Karabiner because Hammerspoon was sufficient.
5. Disable the insert key because I've never wanted its functionality, but I would sometimes hit it accidentally.
[1]: https://github.com/dguo/dotfiles/blob/master/programs/hammer...
[2]: https://www.hammerspoon.org/
For paste blockers I've been using an Alfred workflow that types keys using AppleScript. It doesn't work with characters that require special input like ü, which is annoying, but it's sufficient for passwords. The benefit here is I'm not using up a global hotkey for such an infrequent use-case (especially not one actually used by other apps, such as Terminal.app).
Does Hammerspoon work just as well? Karabiner is so incredibly solid.
I'm hoping Karabiner Elements figures out some solution going forward. It still works on Catalina but the expectation is the "legacy kext" will no longer function on 10.16.
At my new job I'm afraid to download AHK at all :(
I am using it and am curious what are the downsides
One specific reason I want to go with Hammerspoon in the long run for key remapping is that I plan to do more complicated things, like setting up key layers. And even if that's possible with Karabiner, I'd rather maintain the complexity with Lua code rather than Karabiner's JSON configuration, which is complicated enough that someone created a separate tool[1] just to generate the configuration.
I should note that one of the maintainers of Hammerspoon specifically recommended[2] using Karabiner instead of Hammerspoon for key remapping because Karabiner was built to do that. Hammerspoon has a much higher level view of key events, from what I understand. I don't plan to do any remapping with modifier keys though. I plan to only use the letter keys for everything. Something like: press and hold ;, then press and hold v, and then tap a. And that will re-arrange my current windows into my preferred arrangement. Stuff like that. Based on my initial experience, I should be able to do everything with just Hammerspoon.
[1]: https://github.com/yqrashawn/GokuRakuJoudo
[2]: https://github.com/Hammerspoon/hammerspoon/issues/1025#issue...
This is quite common on HDMI monitors. Since the HDMI connection transmits both audio and video, the monitor just accepts both audio and video input. They would then have a 3.5-mm jack to allow you plug in an actual speaker or headphone to receive the audio output.
I use combination of BTT, Karabiner Elements, yabai and skhd to do remappings but this comment has intrigued me to give hammerspoon a shot!
Talking about automation, I use BetterTouchTool[1] to give me a few useful touch bar icons:
- Speaker and headphone buttons (using switchaudio-osx[2])
- Start meeting that starts a Zoom call and adds the link to my clipboard
- Write email that gives me a new blank email (and makes it visible)
[1] https://folivora.ai/
[2] https://github.com/deweller/switchaudio-osx
This one really drives me mad. Is there really any legit reason to this?
By the way my hack is I paste it in the address bar, then just drag-drop into the field. Works 50% of the time or more (fails when a lot of these stupid websites don't use placeholder attribute but rather use some sort of Javascript for the placeholder text)
> This one really drives me mad. Is there really any legit reason to this?
No. Which is why I set the about:config option "dom.event.clipboardevents.enabled" in Firefox to false. That turns off the ability of websites to block pasting in Firefox.
Truly, there are very few legitimate reasons for a site to even know you've copied or pasted something. Makes me think this setting should be a whitelist.
Yes, preventing you to steal their content.
Of course this only works against the technical layman, who does not even think about googeling for a solution to this.
And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps lock, really?
I've actually gone kind of crazy with this idea and made my left ctrl, shift and alt behave as fn+ctrl, fn+shift and fn+alt, so that e.g. left ctrl+h actually does ctrl+left. Then I made fn+[ = pgup, fn+] = pgdn, fn+; = home, fn+' = end and fn+\ = delete, with the same augmented fn+LHS modifiers.
Took me about a week for the muscle memory to catch up and allow me to correctly hit ctrl+L with the right hand when I want to go to the address bar, but now I'm ridiculously fast moving around in Excel without having to touch the arrow keys.
Only downside is I have a relatively problematic left wrist and this set up added to the already LHS stress to the already very imbalanced qwerty layout, so it forced me off mechanical keyboards to a low profile logitech right around the time COVID-19 hit.
If only Excel had vim bindings!!
Recent attempts to lock down the system point to how it’s “not the default” to customize your Mac outside the App Store. And I find the share sheet is still more useful on iOS than on macOS (for now?) just as Finder is more useful on macOS than Files app is on iOS.
That said, Windows Terminal and WSL highlight that Microsoft isn’t slowing down here and Apple might actually need to play catch-up at some point and evaluate new approaches to developer and power user pain points. (AppleCare-supported upgradable storage is on my wish list but that’s not technically the software’s fault... just a policy Apple used to have and then later removed from their website as they moved to proprietary SSD controllers)
Caps Lock is quite useful, because it's the perfect location for remapping the Ctrl- and ESC-Keys. Which is no surprise, as they originally where located there.
Under linux there is a nice tool for overloading keys, so they behave one way when pressed short, and another way when holded longer. With programmable keyboards you even have it OS-independant.
Name please (TIA)
I use https://github.com/alols/xcape for some while now. It's old, reliable and straight forward, just does it's job. Only downside is that it seems to be limted to X11. Not sure how well it will play with wayland.
There are now also some alternative tools, with more ability, which allow overloading just on the side. I have them on my list for a while now, but not done much yet with them.
- https://github.com/david-janssen/kmonad
- https://github.com/mooz/xkeysnail
- https://github.com/snyball/Hawck
Oh, and for rermapping capslock there are also options with X11. I use
to map ctrl to capslock, then overload it with to add ESC ontop.[1] https://github.com/rcmdnk/vim_ahk#applications [2] https://github.com/yamsu/vibreoffice
Really, there are some really smart people at apple. You know some of them have customized their environment. You know apple has internal tools.
Why don't they get it and support customization of their os?
They're also not very supportive of "outside" tools. Say you want to use python on macos. Apple has only the most passing support for it. Same with bash or anything else that could put up a dialog box or whatever without having to compile/use xcode/other barrier to entry.
applescript doesn't count.
I know you can add software like macports or homebrew, but I mean first class support from apple.
Did you overload the ;-key, meaning it sends ; when pressed fast, and acts as modifier when hold and pressed with other keys? Is'nt that kidna painful to use and inflicts false input occasionaly?
I too have some personal modifier-keys. I remaped Pause-key to the Right alt-key, and use for persional settings in apps. And I remapped the left Alt-key to F22, and use it for window managing and staring/raising apps.
Benefit with this is that both keys are exclusively used by me and the pause-key is also available even when my setting is not available.
I find it very easy to use since my pinky finger sits on the ; key by default.
Wished there would be a better way to actually map hyper key that only is activated if pressed down. Well, I went back to BTT and setup fn + and this works too.
https://en.wikipedia.org/wiki/Compose_key
Edit: by the way, these compose sequences also work under Wayland. The only hiccup I found with wayland was that include directives didn't work so I had to put everything in a single file.
I wish there were a Unicode lookup utility app that would display a character's compose sequences if any, but none seem to be under development / accepting feature requests or patches.
I love my Compose key. When I looked into purchasing a Surface Book (and switching to Windows) some four years ago based purely on its specs, the two critical factors were WSL and WinCompose—without either one of those two, I couldn’t have, wouldn’t have switched.
(I also use an AutoHotkey script for a few other things like remapping Win+F to maximise/restore, and disabling the horrifically slow Win+Tab which was too easily triggered by accident.)
many years later I am now a software engineer, I just wanted to manage my catapult on Age of empire 2 ....
So AHK is very powerfull, easy langage and awesome !
--
[0] - https://github.com/fuhsjr00/bug.n
Now, AHK is set up to just reads my design spreadsheets and define everything in a few minutes. I hate the language syntax, but man is it useful! God bless AHK!
These days I use it for fewer things, but still really useful. One of those is making chat applications that don't offer ctrl+enter to send a message - Like Google Hangouts (basically flopping the functionality):
#IfWinActive Google Hangouts ahk_class Chrome_WidgetWin_1
Another extremely useful is this one, which will type what's on the clipboard rather than pasting it: And when I hit shift also, it does it slow (for input lag situations): Extremely useful for two main reasons. 1 being input boxes on websites that prevent pasting and 2. certain remote sessions that prevent pasting (like Kesaya or any kind of Console remote application).I don’t understand this insanity around bank account numbers... they should be treated as public info, they’re on every single check, anyone you’ve given a check to has your account number as does your employer...
Funnily enough (in a sad way), 40% of the JS load on that page appears to be anti-pasting logic & supporting libraries. It appears to be developed in-house, since the scripts aren't obfuscated and a quick search of duckduckgo didn't match any open-source libraries that I could find. If they weren't reliably the cheapest carrier with the fewest issues I would raise a stink, but it's not worth it. That, and I just bypassed this 'feature' with a very similar AHK script, and their website has a very nice UI besides that issue.
Thankfully I've never had to deal with #2
You can mess with league of legends folks a lot with it actually. You can use it to spam 5 pings around someone instantly. You can spam emotes with it. You can write messages quickly in chat.
https://www.2uo.de/my-autohotkey-script/
It was a pretty extensive formula support [2] enabling you to create dynamic snippets. In many ways it's kind of like Excel but for documents.
[1] https://blaze.today/
[2] https://blaze.today/formulas/reference/