AutoHotkey Tip of the Week: Using SplashText for Peace of Mind

Sometimes We Wonder If Our Hotkeys Work At All—The SplashText Command Tells Us That at Least It’s Trying

Note: I accidentally published this blog with the May 25, 2020 date when it should have been June 1, 2020. Trying to fix it only causes more problems, so I’ll leave it as is.

SplashText tells you about an AutoHotkey routine in progress.
SplashText tells the user about an AutoHotkey routine in progress.

I have a bad habit of leaving multiple programs and browser tabs open. Eventually, Windows gets confused and starts slowing things down. When this happens I sometimes wonder if my Hotkeys work. I execute one then sit and wait.

I know that I keep too many windows (and Chrome tabs) open and don’t reboot my computer often enough. This inevitably leads to computer lag. That means even the fastest Hotkey routines can slow down. When I hit a Hotkey and nothing immediate materializes, I wonder if the routine started at all. By adding the SplashText command to my Hotkey routines, at a minimum, I see that the process has gotten underway—even if I need to wait for the result.

The SplashText Command

The AutoHotkey SplashText command places a temporarily always-on-top pop-up informational window on your computer screen. It just sits there until you turn it off—but in the meantime, you can use it to tell you what’s going on in the background:

SplashTextOff
SplashTextOn [, Width, Height, Title, Text]

Along with the more flexible Progress/SplashImage commands, this AutoHotkey feature gives a script a method for communicating current activity to the user. This helps allay concerns when time-consuming actions occur in the background. (The InstantHotstring.ahk script calls the Progress command when loading Hotstrings from a file helping users maintain patience—particularly for long files.)

Library Benefits

* * *

For more information on SpashText, see Chapters 8.1.6 and 16.1.5 in the book Jack’s Motley Assortment of AutoHotkey Tips. For the Progress/SplashImage commands, see Chapter Six of AutoHotkey Applications: Ideas and Tips for Writing Practical AutoHotkey Scripts, Chapter Thirteen, “AutoHotkey Scan Codes, Speech, Sound, and Splash Images in Children’s Apps” and Chapter Seventeen, “Force an Expression (%) in AutoHotkey for More Powerful Commands” of AutoHotkey Hotkey Tips, Tricks, Techniques and Best Practices, and Chapter Nine, “Reset Hotkeys with Label Name Drop-Through Behavior” of Beginning Tips for Writing AutoHotkey Scripts.

* * *

Adding SplashText to AutoHotkey Scripts

By placing the SplashText command at strategic locations in the script, AutoHotkey lets me know that the Hotkey routine started running and/or completed critical actions. I added it at script startup, when loading a new process, and while setting screen capture in the IrfanView Set Screen Capture script from my last blog as follows:

SetTitleMatchMode, 2
^#!y::
  SplashTextOn, 300, 20, Screen Capture
              , Starting Screen Capture
  If !WinExist("IrfanView")
  {
    SplashTextOn, 300, 20, Screen Capture
                , Loading IrfanView
    Run, C:\Program Files\IrfanView\i_view64.exe
    WinWaitActive, IrfanView
    SplashTextOn, 300, 20, Screen Capture
              , Starting Screen Capture
  }
  WinMenuSelectItem, IrfanView, , Options , Capture
  WinActivate, Capture Setup
  WinWaitActive, Capture Setup
  ControlClick , Button22, Capture Setup
  SplashTextOff
Return 

The SplashText command will load only one instance of the pop-up message—either On or Off. To change the message, reissue the SplashTextOn command with new parameters. The snippet above works as follows:

  1. The first SplashTextOn command:
    SplashTextOn,300,20,Screen Capture, Starting Screen Capture
    sets the pop-up dimensions to 300 pixels wide by 20 pixels high with the title “Screen Capture” and the message “Starting Screen Capture”
  2. The second SplashTextOn command:
    SplashTextOn, 300, 20, Screen Capture, Loading IrfanView
    only loads if AutoHotkey finds no running IrfanView window.
  3. After loading IrfanView (if necessary) the SplashText window switches back:
    SplashTextOn,300,20,Screen Capture, Starting Screen Capture
  4. When the routine completes, the SplashText turns off:
    SplashTextOff
    If the pop-up never disappears, then something went wrong.

This little trick saves a great deal of consternation when executing AutoHotkey routines which either take a while or might get lost. If you want more flexibility, try the Progress/SplashImage commands.

Click the Follow button at the top of the sidebar on the right of this page for e-mail notification of new blogs. (If you’re reading this on a tablet or your phone, then you must scroll all the way to the end of the blog—pass any comments—to find the Follow button.)

jack

This post was proofread by Grammarly
(Any other mistakes are all mine.)

(Full disclosure: If you sign up for a free Grammarly account, I get 20¢. I use the spelling/grammar checking service all the time, but, then again, I write a lot more than most people. I recommend Grammarly because it works and it’s free.)

Find my AutoHotkey books at ComputorEdge E-Books!

Find quick-start AutoHotkey classes at “Robotic Desktop Automation with AutoHotkey“!

One thought on “AutoHotkey Tip of the Week: Using SplashText for Peace of Mind

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s