Stop Letting Your AHK Scripts Look Frozen Try ProgressBar AHK v2 Library

Stop Letting Your AHK Scripts Look Frozen, Add a ProgressBar

Long-running AutoHotkey tasks, API calls, file batches, FFmpeg conversions, scraping jobs all share the same problem: while the script is busy, your GUI looks dead. Users start clicking buttons twice. They alt-tab away. Some kill the script thinking it crashed. ProgressBar is a tiny AHK v2 class that fixes that with a single line of code: an animated, theme-able busy overlay that centers on its parent, blocks input while it’s up, and tears itself down when you’re done.

The Two-Line Version

#Include S:\lib\v2\ProgressBar\ProgressBar.ahk
pBar := ProgressBar("Working...")
pBar.Show()
Sleep 3000      ; your real work goes here
pBar.Hide()

That’s it. No GUI plumbing, no timer code, no manual centering. The bar animates in marquee mode (no need to know percent-complete), centers on the primary monitor, and disappears on Hide().

What You Actually Get

  • Owned overlays — pass your main GUI as the parent option and the bar centers over it and disables it while shown, so users can’t double-click your “Run” button.
  • Try/Finally safe — if your work throws, wrap with try / finally pBar.Hide() so the parent never gets stuck disabled.
  • Live message updates — call pBar.SetMessage("Step 3 of 5...") mid-task to keep the user oriented.
  • DPI-aware — renders correctly at 125%/150% Windows scaling.
  • Always-on-top by default — the overlay won’t get buried under other windows.
  • Idempotent — calling Show() twice is harmless; same with Hide().

Themes — Match Your App’s Look

Every visible attribute is a key in an options Map you pass to the constructor. Bar color, trough color, background, text color, font, font size, animation speed — all overridable. Build a theme once and reuse it everywhere.

neon := Map(
    "barColor",      "00FFFF",
    "barBackground", "0A001A",
    "bgColor",       "0A001A",
    "textColor",     "FF00FF",
    "fontName",      "Consolas",
    "fontStyle",     "Bold",
    "timerInterval", 60,
    "stepSize",      5
)
pBar := ProgressBar("Crunching numbers...", neon)
pBar.Show()

Why You’ll Reach For It

It ships as a single ProgressBar.ahk file with thirteen example scripts covering basic use, parented overlays, try/finally cleanup, hotkey-cancellable work, tight loops, large-text variants, compact bars, theme presets, global defaults, HTTP fetches, and batch file processing. Drop it in your lib folder, include it, and you’ve got polished “please wait” feedback for every long-running task in your toolkit.

No more dead-looking GUIs. No more “is it still running?” Slack messages from your users. Just a clean animated overlay that does its job and gets out of the way.

 

Comments are closed.