DarkBox: A Dark-Themed MsgBox Replacement for AutoHotkey v2
You built a sleek dark-themed AutoHotkey app — dark window, dark controls, the works.
Then you pop a MsgBoxand BLAM — a blinding white box flashes in the middle of your beautiful dark UI.
DarkBox
is a drop-in, dark-themed replacement for the built-in message box: same idea, custom buttons, optional icons, and it hands you back exactly which button the user clicked.
.ahk file you#Include — no libraries to install.Why Not Just Use MsgBox?
The built-in MsgBox is fine — until you care how your app looks. It can’t go dark, you’re stuck with Microsoft’s fixed button sets (OK, Yes/No, etc.), and reading the result means decoding return codes. DarkBox fixes all three:
- Looks right in the dark — true dark window, dark title bar, light text. No more white flash.
- Any buttons you want — not just OK/Cancel. Pass Red·Green·Blue, a 1–5 rating row, anything.
- The label IS the answer — click Yes, you get back the word
"Yes". No magic numbers. - Familiar icons — add a warning, info, error, or question icon with one extra word.
- DPI-aware & cancel-safe — crisp on high-DPI screens; Esc or X always returns an empty string.
The Simplest Call
Only the message is required. Title defaults to "DarkBox", buttons default to a single OK:
; The whole signature — only the first value is required DarkBox(text, title := "DarkBox", buttons := "OK", icon := "") ; A one-line notice DarkBox("All done!")
Custom Buttons & Reading the Result
Buttons are a pipe-delimited list. DarkBox pauses your script until the user clicks, then returns the clicked label — so branching is just checking a word. An empty string means the user pressed Esc or closed with X:
choice := DarkBox("Save changes before closing?", "Confirm", "Yes|No|Cancel") switch choice { case "Yes": SaveAndClose() case "No": CloseWithoutSaving() default: ; "Cancel", Esc, or X — stay put }
"Cancel". Handle them together in your default branch if you want them to behave the same.Add an Icon (New in v0.1.1)
Pass one extra word as the fourth value and DarkBox places the matching Windows icon to the left of your message — so a serious alert actually looks serious:
answer := DarkBox("Delete this file permanently?", "Confirm", "Yes|No", "warning")
| Word | Icon | Use it for |
|---|---|---|
| “warning” | Yellow triangle | Caution before something risky |
| “info” | Blue “i” bubble | Plain notices, status updates |
| “error” | Red circle / cross | Something failed |
| “question” | Question mark | Asking the user to decide |
The icon word is case-insensitive and forgives aliases (warn, information, stop). An unrecognized word simply shows no icon — it never errors out.
Chain Them Into a Wizard
Because every call waits for an answer and returns it, you can chain several DarkBoxes into a step-by-step flow — carry each choice forward, and let Esc abort the whole thing at any point:
ChainedWizard() { ; Step 1: opt-in start := DarkBox("Ready to start?", "Step 1 of 3", "Yes|No", "question") if (start != "Yes") return ; Step 2: pick a value — empty string = user bailed pick := DarkBox("Pick a size:", "Step 2 of 3", "Small|Medium|Large") if (pick = "") return ; Step 3: confirm, carrying the choice forward into the message confirm := DarkBox("You picked: " pick "`n`nConfirm and finish?", "Step 3 of 3", "Confirm|Back|Cancel") DarkBox("Done! size=" pick ", confirm=" confirm, "Result", "OK", "info") }
Get DarkBox
One self-contained file, one function, and your dark-themed apps finally stop flashing white.
DarkBox is just $4.99 — grab it below.
Want to see it in action first? The full feature rundown and a runnable examples gallery live on the
DarkBox product page.
Built and maintained by
the-Automator.com
— where we make learning AutoHotkey EASY.
DarkBox v0.1.1 • Requires AutoHotkey v2.0.2+ • Windows 10 / 11 • Single self-contained file

