AHK Update: Targeted File Deleter Program

Welcome to the combo post of How to Delete Every Other File in a Folder and How to Make a GUI. For lack of a better name, I’m calling it a targeted file deleter program. It can automate the process of deleting every other file if the file name ends in sequential numbers.

For those who couldn’t care less about how it functions, just follow these two steps.

STEP 1: Fire up a new AutoHotkey* file.
*Download it here if you haven’t already.

STEP 2: Paste this text inside. And run the file.

Gui, -Caption
Gui, Color, Black
Gui, Font, cWhite s12
Gui, Add, Text, , The Targeted File Deleter
Gui, Add, Text, , Note: File names must be sequential (for ex. IMG_1.jpg) and cannot have leading zeros (IMG_001.jpg).
Gui, Add, Text, , What is the folder you want to delete files from? (Ex. C:\Users\Desktop\)
Gui, Add, Edit, vFilePath w500 cblack
Gui, Add, Text, , How does the file name start? (Do not include numbers)
Gui, Add, Edit, vFileNameStart w500 cblack
Gui, Add, Text, , What number does the file name start at?
Gui, Add, Edit, vFileNumberStart w500 cblack
Gui, Add, Text, , By what increment do you want to delete files?
Gui, Add, Edit, vIncrement w500 cblack
Gui, Add, Text, , What is the file extension? (Ex. .jpg, .pdf, .doc)
Gui, Add, Edit, vExtension w500 cblack
Gui, Add, Text, , How many files have you got total?
Gui, Add, Edit, vLoopCount w500 cblack
Gui, Add, Button, x570 y370, OK
Gui, Add, Button, x570 y410, Cancel
Gui, Show, , The Mass File Deleter

Gui, Submit
if A_Index < %LoopCount%
FileDelete, %FilePath%%FileNameStart%%FileNumberStart%%Extension%


Continue reading “AHK Update: Targeted File Deleter Program”

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.


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

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.


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.


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.


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.


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 ::

In our case, that translates to:


*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


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.


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)?”