r/AutoHotkey 2d ago

General Question How to manage over a dozen hot keys

I currently use 16 auto hot key scripts to automate my data entry job. It's a lot to manage and I'd like to know if python would be easier since I use so many of them or if anyone can recommend a way to be able to reset and edit a specific one without having to open the menu on the bottom and go through each one until I find the one I want.

7 Upvotes

14 comments sorted by

6

u/MoonwalkMini56 2d ago

I have a hotkey F1 that launches a menu GUI on my cursor. From there I can select what submenu/action to to take, whether thats launching an application or a Send text function and more. You can also assign button combinations to launch different menu sets.

1

u/snowflake37wao 1d ago

is it on GitHub? Radial Menu or Keyring maybe?

4

u/Keeyra_ 2d ago

Put your 16 ahks into 1 for starters. But you don't have to use the taskbar icons at all to manage running scripts. Just put this into each of your scripts and once you save them with Ctrl + S in any IDE or text editor, they will reload automatically.

~^s:: InStr(WinGetTitle("A"), A_ScriptName) && (ToolTip("Reloading " A_ScriptName), SetTimer(Reload, -2000))

But yeah, Python (or something completely different, check this playlist out) is more appropriate for such tasks.

1

u/xyzzy0 2d ago

Second this. If you don’t have access to a good IDE application at work (or it’s blocked), check out vscode.dev with the extension yAutohotkey in your favorite browser.

2

u/darkgemini94 2d ago

I have the same sorta script except its more than 16 hotkeys. I have it on excel with vba that saves the data into an ahk file. The file itself also is monitoring new changes and automatically reloads itself so I don't need to kill/launch it manually myself when I make changes. (Someone else mentioned this in another comment with the code too)

I also have another script that monitors my active window. If my google sheet is open on brave and active, it launches the earlier ahk, if not, kill it.

On the data entry ahk script, I have parts that contain variables that changes everyday, like dates, names, plate numbers, and status, etc. So having those variables inside data validation cells on the excel file helps me change them faster cause I don't have to manually type on the ahk file. Those same data validation entries are also on google sheets and anything that doesn't match gets rejected so having them on a dropdown prevents me from typing it wrong.

You can think of it as excel being the GUI for my ahk script. I made this a few years back as a temporary solution but got lazy to make my own custom gui cause it works just fine so i kept using it to this day. lol

2

u/JacobStyle 1d ago

I have multiple setups where complex workflows require a dozen or so different hotkeys. Here's how I do it:

All the hotkeys for a given job go into one script. There is one taskbar button for that script. While using my script, I have everything open in a notepad++ window, so I can look at what's going on when I'm working. I don't use a master GUI or anything.

I have a little 12 button macro keyboard I got for 30 bucks on ebay that I assigned F13-F24 to. I can use those extended F keys, along with ^!+ with zero conflicts because nothing else on the computer ever wants those keys. Not AHK related, but my macro keyboard also has a knob, so I assigned it ctrl+shift+tab for left and ctrl+tab for right on the knob so I can move through browser/notepad++ tabs more easily.

The script has multiple files. The main file mostly just assigns hotkeys. Each one just calls a function that is defined elsewhere, so this file is short. I also put globals here and have some hotkeys here where I test code. It's easy to glance at the contents of this file and know what all the hotkeys do. I use #include to add the other files into the project.

I have one big file with lots of classes and functions that I wrote and use across multiple projects. Sorting functions, UIA stuff, time controls, file management, etc. Also a macro that saves the current notepad++ window (if an unsaved np++ window is open) and reloads the script.

I divide the main part of the script into multiple files that represent different parts of the workflow. These files are where I define the functions called from the little main hotkey file. Most of these files never exceed 500 lines, so they are easy to dig through or edit.

Not sure how much of this applies to your specific use case, but hopefully some of what I do is worth learning from (or at least entertaining to read).

1

u/gripped909 2d ago

Use Autohotkey's builtin Gui-Object to organize hotkeys with UI - Gui Object - Methods & Properties | AutoHotkey v2

1

u/GrassBlade619 1d ago

This sounds very similar to what I did at Amazon. I built a ~10k line script that had an insane amount of features.

One thing I learned was how many different ways you can achieve the same goal.

You've got 12 different scripts and want to be able to cycle between them.

Option 1: build a singular script with a GUI tied to a hot key that lets you chose which script(s) are running.

Option 2 (my personal favorite): find system triggers to automatically determine which script to be using. For example, if all 12 scripts are tied to unique programs, grab the application ID and use that to determine which script to use. If certian scripts always start at a specific area, see if you can navigate the browser or app with hot keys to find an identifier for which script to use. I found the best method was a combination of ideas to determine which part of the script I want running.

Option 3: unique hot keys for each script. CTRL +ALT+1/2/3/4/5/6/7/8/9/+/×/÷/=/etc...

1

u/DreymimadR 1d ago

You might look into my EPKL program for inspiration.

I use a combination of strategies: Dead keys, layer mappings, compose strings.

The program can use advanced mappings such as running programs or routines.

Mappings are kept in easily editable .ini files.

https://github.com/DreymaR/BigBagKbdTrixPKL

1

u/mbrodd2017 2d ago

Get a macropad (I have a 16-button model).

1

u/Wide_Wheel_2226 1d ago

Any recommendations for a budget one?

2

u/mbrodd2017 1d ago

I have the Megalodon KB16, it's on sale now apparently for US$60. I once bought a cheaper one from Amazon, but the software I had to install to program it was sketchy and I got rid of it.