Recognize Running Scripts with System Tray Icon Techniques (AutoHotkey Tip)

If You Run a Number of AutoHotkey Scripts Simultaneously, Distinguish Each Icon in the Windows System Tray with These Menu Commands

At times, I’ve found that I have six or more AutoHotkey scripts running at the same time. Each one adds the little green icon with an embedded “H” to the Windows System Tray. This gets confusing. I can only tell them apart by hovering the mouse cursor over an icon and reading the script name in the Tooltip pop-up message. Sometimes the Tooltip alone doesn’t do an adequate job.

AutoHotkey includes two methods for identifying running scripts via the Windows System Tray icon located on the right side of the Taskbar: the pop-up tooltip message revealed when the cursor hovers over the icon and the icon’s image itself—both subject to change using the Menu command. If you run a number of AutoHotkey scripts simultaneously, these features make distinguishing active apps easier. The Tooltip message either identifies the script or displays a useful instructional message. Changing the icon image helps to instantly identify running AutoHotkey scripts.

System Tray AutoHotkey Icon Tooltip Message

You can set the pop-up Tooltip message to almost anything you like.

Whenever you move the mouse cursor over an AutoHotkey icon, a Tooltip message pop-ups. At a minimum, hovering over the AutoHotkey icon displays the name of the AutoHotkey script.  But, you can improve it by changing the message to something informational.

For example, after converting the System Tray icon for the InstantHotkeyArrays.ahk script into a one-click action button creating a new Hotkey:

Menu, Tray, Default, Instant Hotkeys
Menu, Tray, Click, 1

I changed the message to “Click for New Instant Hotkey!” using the Menu, Tray, Tip command:

Menu, Tray, Tip, Click for New Instant Hotkey!

Now hovering over the icon tells users about the one-click feature.

IconTooltip2Although AutoHotkey only displays the last Menu, Tray, Tip command encountered in an omnibus AutoHotkey file, you can include additional lines by inserting the `r (carriage return) or `n (newline) character:

Menu, Tray, Tip
      , Click for New Instant Hotkey!`r(Right-click for more options.)

(Line continuation used to wrap the command line for display purposes.)

Dynamically change the Tooltip by merely reissuing the Menu, Tray, Tip command with new text.

Since AutoHotkey limits the Tooltip to 127 characters, you won’t likely use this technique to create an extensive Tooltip help pop-up. The built-in variable A_IconTip contains the Tooltip text—if any—for use elsewhere.

Changing the System Tray Icon Image

Even better, you can instantly recognize an AutoHotkey app by changing the icon image to something related to the script. You can either create your own icon image or use the images built into Windows.

CheeseBurgerFor example, I added melted cheese to a common hamburger image (shown above) with my favorite paint program—Paint.NET. (If you access the Paint.NET download page, avoid the green download button—which is not Paint.NET—and go directly to the free download directly below it.) I used this burger image when working on the CheeseBurgerRecipe.ahk demonstration script—which includes recipes for some pretty good burgers. (I know…the cheese in the image looks a little cheezy—pun intended—but after reducing it to icon size, no one will notice.)

Next, I used IrfanView to create the ICO (icon) file by first reducing standard image file (e.g. JPG, PNG, TIFF, …) to 32×32 pixels, then saving it as an ICO file. AutoHotkey automatically reduces large ICO files to fit, however, I’ve found that I have more control over the final product if I first reduce it myself. Otherwise, the results may vary when using the icon in a number of different applications.

Generally, standard ICO files use either a 32×32 pixel or 16×16 pixel image. My reduced 32×32 icon file looks like this:  CheeseBurgerWhiteIcon

When I add that image to the System Icon Tray through AutoHotkey, it looks like this in the System Tray: CheeseBurgerWhiteIcon16

Since AutoHotkey only uses the file types ICO, CUR, ANI, EXE, DLL, CPL, and SCR for inserting images into the System Tray icon, you might find it easier to draw upon the many EXE and DLL files included with Windows rather than create your own ICO through an image conversion program such as IrfanView. You can use the tools mentioned in Finding Windows Icons for AutoHotkey Menus (Quick Tip) to review and select icons in individual files.

Add the image to an icon with the following AutoHotkey Menu, Tray, Icon command:

Menu, Tray, Icon, C:\Windows\System32\shell32.dll, 319

This line of code extracts: Icon319Shell32

Merely, include the path and filename, plus the icon number. If you don’t include an icon number, AutoHotkey uses the first image. For your personal icons, replace the path and filename with that of your ICO file (e.g. C:\Windows\AutoHotkey\InstantHotkey.ico).

Remember, the last occurrence of the Menu, Tray, Icon command replaces all other previous changes in an AutoHotkey script.


ComputorEdge E-Books


Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s