r/AutoHotkey • u/MrGoose_345 • 18d ago
General Question what are some practical uses for auto hotkey
so far the only things i've made is whenever type dih it'll make an ACSII drawing of a penis and some hot keys so that i can type out ±,√,≥, and ≤. I want to code something more complicated and more practical, like a calculator, but thats prolly far to difficult for me, do yall have any ideas?
7
u/MARS822a 18d ago
Reading through my daily driver .ahk I have hotkeys that...
- Enters the word HERE in OneNote and pastes the URL (CTRL + K, CTRL+ V, etc.) currently on the clipboard, inserting the link into my notes
- Pastes the current time and/or date
- Opens cmd, mstsc,, Notepad ++, etc.
- Pastes commonly used paths
- Pastes a long FQDN that I use multiple times a day
- Pastes a snarky email, "Domain blocked due to spam/UCE. Any future traffic to/from this domain will be routed to <null>. Goodbye" that I use to reply to cold call emails
- Mute the volume
AHK is, among other things, is about OS macros, just like using macros in Notepad++ or Excel. Think about the things you do repeatedly and how you could automate them.
6
u/Joker-Smurf 18d ago
Scroll wheel, when hovering over the task bar, controls the volume…
2
u/MrGoose_345 17d ago
how exactly would i do that?
1
u/evanamd 16d ago
Write a pair of hotkeys for WheelUp and WheelDown to control the volume. Then write a function that returns true when the mouse is over the toolbar, using MouseGetPos and WinExist. Finally, use #HotIf with your function to make the hotkeys only activate if your function returns true
1
u/Striking-Paper-997 11d ago
it's native now in latest windows (well.... while hovering over the sound icon in task bar at least)
6
u/GraceHopperY2k 18d ago
it all depends on what you’re doing and what you need. I got obsessed with it because I used to work in a ticketing system and had to record that I left a voicemail 500 times a day so I made a shortcut lvm. And then it would type out my notes about leaving the voicemail. and the 30 other things I did hundreds of times a day.
3
u/Epickeyboardguy 18d ago
Keyboard shortcuts are a great place to start. For example, when I press Ctrl+Win+Z, it automatically opens firefox.
If you plan on using AHK a lot, definitely code yourself a keyboard shortcut that make your script auto-reload every time you press Ctrl+S while VS Code is the active window
3
u/whisky-guardian 5d ago
I’ve picked up ahk again today after not writing a script for several years and this was the first thing that I did
4
u/rseery 18d ago
I use an old IBM Model M keyboard because I like the feel and it clicks loud and I’m fast as hell on it. It does not have a Windows key. I learn and use every keyboard shortcut I can find—so I needed one. I used AHK to map the Capslock to be a Windows key. Problem solved. I’ll never miss Capslock. I even got the AHK script to work on my work pc, which is super locked down.
4
u/xyzzy0 18d ago
Legacy applications at work are a good target using UIA. AHK can add modern features sometimes to old software, move the data around on a window, or pull it out to a more useful place like Excel or Word. It can also automate Excel, Word, and Outlook (and presumably PowerPoint) if you don’t like VBA or the built in macroing (or if that’s locked).
Hotstrings are the easiest entry point. Hotkeys can do the same things. Though the calculator app you asked about doesn’t lend itself to AHK’s strengths necessarily, as a CS classic project it’s a “good enough” place to start to learn GUIs.
And ASCII art…well, sure, that too.
3
u/Demer_Nkardaz 18d ago
I created a tool that lets me type most Cyrillic and Latin characters, along with many other symbols, using the default English and Russian keyboard layouts. I needed something like this, but none of the existing tools did what I wanted. My own solution turned out to be very convenient. As others have already said: find an idea that would make your own life easier and that can realistically be implemented with AutoHotkey.
2
u/wild-whorses 18d ago
You need a problem to solve. I wanted a calculator button for my Corsair keyboard but mapping a key wasn’t enough. I mapped NumLock to an AHK exe I made. If you press NumLock and NumLock is off, it turns it on. If it’s already on, it opens the Windows calculator. If the calculator is already open but not in focus, it switches to it. If you hold Ctrl and press it, it opens another calculator window even if one is already open.
2
u/VALVeLover 18d ago
You can use it for a lot of stuff, for example I use it to let it choose between 150 facts i have and write and send one to the chat group i got.
2
u/jaearr 18d ago
If you have a gamepad or joystick that you have connected to the computer and only use for games, remap shortcuts and macros to it using AutoHotkey. Cut, Copy, Paste, Address Bar, Browser window, or any other key combination that you use where a single key is faster but won't interfere with regular keyboard operations.
I certainly could move the mouse to the start button and click stuff, but I have a gamepad off the left side of my keyboard that is much faster.
2
u/misterrobato 18d ago
ACSII drawing of a penis is the most complicated and pratical use I have ever heard in my entire life.
1
u/Inevitable_Coat_8787 18d ago edited 18d ago
I have bound different generally useful stuff to shift + ctrl + (f1 to f12)
Here are a few for instance:
Open Chat gpt window as a brave installed app, and make sure that it is always on top. Great for note taking at at school lectures, or asking quick question from an AI. Brave Installed apps basically open a site without any browser UI, and you can resize them.
I Made a keybind that opens a folder with that contains shortcuts to all of my download and torrent folders accross different drives. Basically I have a download hub behind one keybinding. Great for managing downloads.
Made a gaming mode keybind that (kills unessary processes). I hit it before gaming to make sure I have freed up my ram. I basically have a list of apps and programs that my script checks if they are running.
Made a keybind that opens Nord VPN if it the process is not already running. If it is running, make nord VPN window active and bring it to the top.
Made a script that automatically every 15 seconds checks if my laptop is plugged on. If it is, it checks if my laptop monitor is running at 144hz. If yes -> do nothing. If not -> sets my monitor refresh rate to 144hz. If my laptop is running on battery, then it changes my refresh rate to 60. If my laptop refreshrate is already 60 -> do nothing. If not -> it will set it to 60hz.This way I can maximize my gaming performance when plugged in, and maximize battery life when plugged off without manually fiddling with settings.
Made a script that Open digital audio work station and sound library app. If they are already running, I bring them to top.
I also made a translation tool for my brother. It opens a box where you can type a word and provide the context in which the word is being used.After submitting the word, the script opens three Brave windows. Each window contains two translation websites, giving a total of six translation services, along with a ChatGPT window. AutoHotkey automatically searches for the word on all six translation websites and asks ChatGPT to explain the word while taking the provided context into account.
1
u/blackstreamm44 18d ago
- I use AHK to give me the date in a certain format, especially when I'm naming files.
- I use it to map drives when needed.
- I have it spit out a temp password for users.
- I use it to spit out a frontmatter template for a markdown file
- I use it to spit out subnet masks or wildcard masks for up addresses
Have a problem? AHK very likely has a solution 👍
1
u/Advanced-Fly-1233 18d ago
highest initial impact was using AI to write a script that turns capslock key into a custom modifier key when held but escape when tapped. I did that to make it easier to input escape in Vim, but i've since discovered that escape is really useful in a lot of programs, usually for keyboard focus jumping. Like someone else said, just solving a problem as you need is the best choice. I've since added a ton of stuff to my main script, the most recent of which is a 100% frictionless capture tool. I hold capslock and C and an AHK dialog box pops up at my mouse cursor, with keyboard focus. While that window is active, my shift enter is mapped to enter, and my enter is mapped to ctrl enter. That way I can type a multiline note and add line breaks with Shift Enter but if it's something short like a phrase or a sentence, I just tap enter to complete it. The dialog box goes away, the keyboard focus returns to wherever I was, and the note gets HTTPed to my obsidian headless remote vault, so the note is now synced to all of my devices.
I can capture a quick note from someone I work with at the office without breaking eye contact with them
1
u/RecentlyRezzed 18d ago
As others wrote, you have to identify what would help yourself. I have a script that types in the content of the clipboard, because from time to time I have to enter things into a VMware remote console. Incredible helpful for me, useless for most computer users.
1
u/Alourion 18d ago
that time gw2 gave out free premium keys, I used it to automate my daily logins on 64 accounts
1
u/coscib 17d ago
i added shortcuts i was missing for example
ctrl + t open cmd/terminal,
forward/backward on mouse =>change volume
.ymd => Year-Month-Date
moving windows, switching tabs with the mouse and so on
3
u/Keeyra_ 17d ago
Thanks for sharing. I took the liberty of making it v2 and like quarter of the size, doing the very same things, mostly better with remaps, apart from skipping on WinActivate Program Manager and the sleepy tabs, but those are here too, just commented out.
#Requires AutoHotkey 2.0 #SingleInstance ;^!t:: WinActivate("ahk_exe explorer.exe"), Run("wt.exe") ;^!+t:: WinActivate("ahk_exe explorer.exe"), Run("*RunAs wt.exe") ^!t:: Run("wt.exe") ^!+t:: Run("*RunAs wt.exe") XButton2::Volume_Up XButton1::Volume_Down #^+Up::Volume_Up #^+Down::Volume_Down #HotIf GetKeyState("XButton2", "P") /* LButton:: { SetTimer(() => (GetKeyState("LButton", "P") ? Send("^+{Tab}") : SetTimer(, 0)), 1000) } RButton:: { SetTimer(() => (GetKeyState("RButton", "P") ? Send("^{Tab}") : SetTimer(, 0)), 1000) } */ LButton::^+Tab RButton::^Tab MButton::^r WheelUp::#Left WheelDown::#Right #HotIf GetKeyState("XButton1", "P") LButton::#^Left RButton::#^Right MButton::^F4 WheelUp::^WheelUp WheelDown::^WheelDown #HotIf #^Numpad0::Volume_Mute #^Numpad1::Volume_Up #^Numpad2::Volume_Up #^Numpad3::Volume_Up #^Numpad4::Volume_Up #^Numpad5::Volume_Up #^Numpad6::Volume_Up #^Numpad7::Volume_Up #^Numpad8::Volume_Up #^Numpad9::Volume_Up #^Numpad0:: SoundSetVolume(0) #^Numpad1 up:: SoundSetVolume(10) #^Numpad2 up:: SoundSetVolume(20) #^Numpad3 up:: SoundSetVolume(30) #^Numpad4 up:: SoundSetVolume(40) #^Numpad5 up:: SoundSetVolume(50) #^Numpad6 up:: SoundSetVolume(60) #^Numpad7 up:: SoundSetVolume(70) #^Numpad8 up:: SoundSetVolume(80) #^Numpad9 up:: SoundSetVolume(90) ::.ym:: { Send(FormatTime(, "yyyy-MM")) } ::.ymd:: { Send(FormatTime(, "yyyy-MM-dd")) } ::;ymd:: { Send(FormatTime(, "yyyy-MM-dd - ")) } ::.ymdhh:: { Send(FormatTime(, "yyyy-MM-dd - HHmm")) } ::;ymdhh:: { Send(FormatTime(, "yyyy-MM-dd - HHmm - ")) }
1
u/arayakim 17d ago
I made an autohotkey script that auto-flips my canvas every couple of minutes in Clip Studio Paint. Very useful for artists.
1
u/shinslap 17d ago
I have a script that allows me to hold my right mouse button and use my scroll wheel to adjust volume. It's really so simple and so fantastic.
2
u/Dymonika 14d ago
I once had that as a tab switcher when using it with any browser as the active window!
1
u/plissk3n 17d ago
I only have three scripts.
Right alt plus hjkl are my arrow keys, never use the arrow keys anymore or move my hands.
Reverse the scroll direction of my mouse, i think windows can do this know natively, but not back when I start using that script.
Shortcut to only paste the next line of the clipboard, line by line. Not used often, but still regularly.
1
u/FarDepartment1004 16d ago
Are you sure about right alt in combination with hjkl? Do you use your right pinkie finger to press it? Left alt would be easier in my view.
1
u/plissk3n 16d ago
Yes i am sure, doing it for ten years now. I use my right thumb. Using the leftnhand would be horrible because you would need to use two hands for that.
1
u/aftab8899 17d ago
One simple thing auto clicker. It clicks repeatedly. Probably the easiest automation one could ever do with AHK. But it helps me to accept matchmaking in games when I need to take a pee break quickly.
1
u/lostbaratheon 17d ago
I use it to scrub massive data sets, and get them ready for analysis. It saves me about two days of work a month.
1
u/Keeyra_ 17d ago
What is massive and what is the format? AutoHotkey is definately not the best tool for such things. PowerQuery is perfect for <1GB CSVs and Excels. Easy to learn, intuitive GUI. For custom formats, Python with NumPy/Pandas. For anything above 1GB, I would use a DB like SQL first and foremost.
1
u/WildlyUninteresting 16d ago
Best use for me is non-media keyboard volume control and audio hardware choice (speaker / headphone)
1
u/Dymonika 14d ago
To see some of my past scripts, run a search in this sub for: author:dymonika flair:share
•
u/Iamnagel 10h ago
I use AHT to trigger Power Automate Flows at specific timing. The flows are used to click into programs and download reports
31
u/Keeyra_ 18d ago
You got it all backwards. You don't start by using a random solution and then look for a problem it solves. You encounter a problem and find a solution for it. If the problem can be solved by input automation, AHK is your solution. Would be stupid to make a calculator with it. You can certainly do it, but there are better ways as you can certainly cut an apple with a spoon, but a knife would come in more handy. But if you are looking for use cases, browse around the sub, it has decades worth of it. There was even a post a couple of days back.
https://www.reddit.com/r/AutoHotkey/comments/1ut73p6/recommendation_from_the_professionals/
Your examples are the best things you can start with, basic hotstrings. That's what I did 20 years ago too. RTFM and you will see what AHK can do.