However, for other beginners like me, be warned: Such a high setting for the A_MaxHotkeysPerInterval command can freeze your whole system for at least several seconds with certain hotkeys!
That's enough to know for people who come across this and want a quick answer to their problem. But if someone wants to understand how I discovered this, which may help people who answer beginners' questions if my circumstances match the details that someone else posts on the forums, for example, then please read on.
It is safe to assume that I may not be the only one who sort of "inherited" this line at the top of my main AHK script, and it has always been there without me understanding in the beginning what it really does. And even if I understood, the line has been added years ago, and I pretty much forgot about it.
In the last few days, my whole computer would sometimes freeze for more than a minute and become unresponsive or extremely slow to respond. And for the life of me, I couldn't figure out what it was. I reinstalled an antivirus, tracked the PC performance in Task Manager, and saw nothing out of the ordinary or suspicious. It wasn't until the last few minutes that it suddenly dawned on me instinctively that the computer behaved that way — froze like that — when I pressed specific keys: Shift+2. And I remembered that that shortcut has been in my main AHK script for years. So, I made the connection and did some research. I tested the simplest script and saw the error message, "71 hotkeys have been received in the last 31ms," with the super helpful addition, "(see A_MaxHotkeysPerInterval in the help file)." Mind you, this error message did not show up when I had the script with A_MaxHotkeysPerInterval := 10000 running!
At that point, it was easy for me to remember that line at the top of my main script, and I understood what was happening.
This wasn't a problem with AHK v1, maybe because I had the code as:
Code: Select all
+2::
send {@}
return
After my fairly recent upgrade from AHK v1 to v2, however, I changed the hotkey code to:
Code: Select all
+2:: {
Send "@"
}
However, my computer and script worked just fine after removing the A_MaxHotkeysPerInterval line altogether just to be safe and changing the hotkey code to:
Code: Select all
$+2:: {
Send "@"
}
Code: Select all
$+3:: {
Send "{#}"
}
I hope this can help others somehow. I can't post in Tutorials, not asking for help here, and my post is more of a warning to beginners rather than a "working script," so I didn't know where else to post this on the forums.