4 ms·
All of my favorite things are little AutoHotkey shortcuts. I have several that basically just execute a Regex replace on whatever text is currently highlighted.
by cfiggers 4y ago
All of my favorite things are little AutoHotkey shortcuts. I have several that basically just execute a Regex replace on whatever text is currently highlighted. It's ridiculously convenient to just have those functions ready to go any time.
But I started accumulating so many of them, it got to be a problem just remembering all the ones I had and how to trigger them. I had to start finding new ways of keeping them all organized. That led to figuring out two things that I'm still really proud of and use every day: custom right-click menus and Emacs-style keychords.
The custom right-click menu is: any time I right-click while also holding down Ctrl or Alt, it opens a right-click dialogue run by AutoHotkey, not the default one in the given context. That lets me visually select what I want to happen rather than needing an arcane key combo for every thing. All of my frequently-used Regex functions are right-click menus now.
The key chords are: if I trigger a "prep" hotkey first—my most-used one is "Alt+G" for "Go-to"—it sets up a keyboard hook that listens for the next key and then dispatches to a function based on that. So, "Alt+G H" would be really easy to remember in my head as "Go to Hacker news." And it pops open a new tab in my browser. I use that one a lot for opening desktop applications—"Alt+O C" maps in my head to "Open vs Code." Super easy to remember.
I've automated 80% of the most common navigation items at my job this way. My coworkers have seen me do it and stopped me to ask, "Wait, tell me how you did that." It looks and feels like magic.
- ethanpil 4y agoI'm approaching your threshold of "I started accumulating so many of them, it got to be a problem just remembering all the ones I had and how to trigger them" Can you share a repo with your "custom right-click menus and Emacs-style keychords" to save me some time? Love hacker news!
- cfiggers 4y agoSure, here's a Gist for each one: - Key chords: https://gist.github.com/CFiggers/ccb6bc911ee87f423f558368128d433e https://gist.github.com/CFiggers/ccb6bc911ee87f423f558368128... - Right-click menus: https://gist.github.com/CFiggers/96bc37ca468909c9ec83252144c1075e https://gist.github.com/CFiggers/96bc37ca468909c9ec83252144c... Let me know if you have questions. Enjoy!
- 123pie123 4y agoI did something similar but using Autoit I used the dialog box to create little 'applications' such as listing all the printers in the building (along with description) and allowing the staff to choose the printers they wanted to use (back around 2005 ish) I had loads of these little scripts for staff to use - and some server side stuff (mainly windows) such as generating daily configs and collecting all the logs and looking for differences I pretty much automated half my job, allowing me to do more interesting stuff
- puika 4y agoAnother interesting trick is to have a capslock layer (or any other "useless" key you may have, but capslock is much easier to reach obviously) with something like: ; ahk v1 code CapsLock:: KeyWait, CapsLock If (A_PriorKey="CapsLock") SetCapsLockState, % GetKeyState("CapsLock","T") ? "Off" : "On" Return #If, GetKeyState("CapsLock", "P") u:: ; convert selection to code in markdown by pressing CapsLock+u SendRaw, ```` SendInput {Left} Return ; ... #If I also find myself with way too many obscure Mouse button {1|2}, Ctrl, Alt, Capslock, F{1|12}, etc. incantations I never remember and end up opening the script to search them. I thought about adding pie menus based on context but never got to it. Would you mind sharing a minimal example of your right click menu? Sounds much simpler and accessible. The keyboard hook à la vscode chords also seems pretty useful, will definitely implement that
- cfiggers 4y agoHere's some Gists that show a simple example of each concept: - Key chords: https://gist.github.com/CFiggers/ccb6bc911ee87f423f558368128d433e https://gist.github.com/CFiggers/ccb6bc911ee87f423f558368128... - Right-click menus: https://gist.github.com/CFiggers/96bc37ca468909c9ec83252144c1075e https://gist.github.com/CFiggers/96bc37ca468909c9ec83252144c... Let me know if you have questions. Enjoy!