AHK: How to Make a User Interface

I loathe ComputerSpeak.

Missed commas. Misspelled commands. A { instead of a ( because those bastards look exactly alike. Opening the script guarantees that I will make at least one of these errors while updating the code to do something slightly different.

So in order to combat this, I’m making my script a muzzle.

Call it a GUI (Graphical User Interface), call it a window, call it a box-it’s all the same to me. Essentially I’m turning this jumble of script on the right to this nice, soothing thing on the left.

GUI5

In the interest of keeping it simple, let’s make the simplest GUI possible and build up from there.

Continue reading “AHK: How to Make a User Interface”

AHK: How To Delete Every Other File in a Folder

STEP 1: Make a new AutoHotkey file. Not sure how to do that? Click here.

STEP 2: Right click your new AutoHotKey Script → Edit Script.

STEP 3: Copy and paste this text into the body.

Var = 8071
Loop, 100
{
FileDelete, C:\Users\Desktop\Sentient Webcam\IMG_%Var%.jpg
       Var+=2
}
return

STEP 4: Go to the folder with all the files in it, and copy the file path so the computer knows where to look. Paste that in place of the red text in the script.

FilePath

Continue reading “AHK: How To Delete Every Other File in a Folder”

AHK: How To Make a Hotkey

A hotkey (AKA keyboard shortcut) is a combination of keys that tell your computer to do something.

You’ve probably seen these before:
CTRL + C         Copy
CTRL + X         Cut
ALT + F4          Close the active window

Today we’re going to make one of our own. I want to be able to tap a key that opens the internet at a specific page. Because I am lazy, I’m writing this in Notepad. Entirely doable with AutoHotkey. If you don’t know what that is, read this.

STEP 1: Download AUTOHOTKEY.

Sidenote: I’m warning you now, Autohotkey is a gate-way drug. It’s mellow. It’s accessible. And it can definitely put you on the path to using things that horrify you now. Maybe even the command prompt.

EvilCommandPrompt

STEP 2: Right click the desktop → New → AutoHotKey Script.

STEP 3: Name it something obvious.

STEP 4: Right click your new AutoHotKey Script → Edit Script.

If all is well, you should see this.

Notepad

STEP 5: Don’t panic. You don’t need to know anything about any of the text that comes inside of it.

STEP 6: Underneath that text, use this formula to tell the computer what you want. I’m going to have it open Firefox and route to BBC News.

HotKey1 & HotKey2 ::
run, 
NameOfProgram.exe
return

In our case, that translates to:

Script1

*Yes, ! means ALT in computerspeak. In this context. More on this later.

STEP 7: Close Notepad → Right click the script you just created → Run Script

Sc1.gif

STEP 8: Press Alt and n to see it work.

What is AutoHotkey (AHK)?

Computers have a multiple languages—many of which are completely indecipherable. But if you can learn the vocabulary, the grammar, and the rules of punctuation, you can tell the damn thing to do whatever you want.

AutoHotkey uses a fairly simple scripting language, and after a quick software download (offered here), you can start coding straight into Notepad.

computerSpeak

As a beginner, even with the AutoHotkey tutorials, this is still a quite confusing, so I’ve compiled a little list of things I wish I’d known when I got started.

Continue reading “What is AutoHotkey (AHK)?”