Today I Learned - Rocky Kev

TIL about AutoHotKey

POSTED ON:

TAGS:

In a game I was playing, it was getting super annoying to:

  1. press up
  2. Buy an item (you could only buy one)
  3. wait 5 seconds for the animation
  4. repeat it 1000 more times.

I discovered this: AutoHotKey

Powerful. Easy to learn.
The ultimate automation scripting language for Windows.

So what you do is you write a script that fires keystrokes.
You then open your script in AutoHotkey, and then fire the 'activator' key.

Here's the script I found:

Filename: dangaronpa-autobuy.ahk

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

~CapsLock::
{
 loop
 {
  if GetKeyState("CapsLock", "T")
  {
   Send {Down down}
   Send {Return down}
   Sleep, 100
   Send {Return up}
   Send {Down up}
   Sleep, 7000
  }
  else
  {
   Break
  }
 }
}
return

How to use:

  1. I run the script in AutoHotkey
  2. When I press CapsLock...
  3. It loops through that event.
  4. It'll send down, hit the action, sleep, repeat.

Reference - Danganronpa guide by n4f


Related TILs

Tagged:

TIL prefers-color-scheme automatically

For swapping between light mode and dark mode, you don't need JS. Using the `prefers-color-scheme`, that will automatically run the design code based on the user's preference.

TIL unzipping a file in node using zlib

Since my application needs to read whatever is inside that '.gz' file, I had to figure out a way to simplify that. That was done with zlib.

TIL about AutoHotKey

When you're getting annoyed at running the same commands over and over again.