AutoHotkey Tip of the Week: Windows Trick for Adding Embedded Folder Icons to QuickLinks Menus

This Technique Accesses Icons Embedded in Windows Folders for Inserting into Pop-up Menus—Plus, the New Combined Switch/Case Statement QuickLinks QL_GetIcon() Function

I completely rewrote the functions from the last blog for adding icons to the menus in the QuickLinks.ahk script combining the two into a shorter prioritized list using Switch/Case statements. In the process—after investigating how to read icons embedded in Windows folder/directory listings—I discovered an interesting Windows secret. It turns out that this procedure requires a totally different Windows maneuver than that used for reading Windows Shortcut file icons.

The Windows Desktop.ini File

UnHideFiles
Ryan’s UnHideFiles.ahk script makes Windows Registry changes to hide and unhide files.

When you embed an icon into a Windows folder (right-click on the folder name in Windows File Explorer, select Properties and the Customize tap, then click Change Icon… and browse for icons), rather than saving the icon path and icon number in the folder itself—as Windows does for shortcut files—it creates a special hidden file named desktop.ini in that same folder. With Windows set to Show Hidden Files, folder and drives in the View tab of the Folder Options window, you can view the hidden desktop.ini file in that folder. (Tip: You can use Ryan’s UnHideFiles.ahk script to hide and unhide files and folders.) Continue reading

AutoHotkey Tip of the Week: Adding Icons to Menus the Easy Way(?)

Inserting Icons into Your AutoHotkey Menus Makes Options Standout and Easy to Navigate, But You May Need to Prioritize the Methods for Adding Icons

I’ve employed icons in my QuickLink.ahk script for many years, but the process I used for adding them to menu items always felt awkward and messy—too much special-purpose code.

I want the script to standalone without needing much tailoring. Most changes should occur in Windows File Explorer by creating folders or editing shortcuts. Then the QuickLinks.ahk script should read all the Menu items from that folder/file structure—including menu icons. However, my implementation of icons gets a bit sloppy. For my own QuickLinks, I added numerous special lines of code to deal with the inconsistencies in how Windows deals with folder and file icons. I’ve never felt comfortable with how it worked.

My recent work implementing the Switch/Case statements has prompted me to return to my original goal of producing a script needing little or no adapting. That means not only constructing the AutoHotkey menu directly from the folder/file structure shown in Windows File Explorer, but the menu icons themselves should load from those folders and shortcut files without requiring additional unique lines of AutoHotkey code in the script.

Continue reading

AutoHotkey Tip of the Week: Add Dynamic Submenus to Static Menus Using Menu, DeleteAll

How to Add an Updating Dynamic Submenu to a Static AutoHotkey MenuUnderstanding the Difference Between Menu, DeleteAll Command and Menu, Delete Command

When I first wrote the HotstringMenu.ahk script, I planned it as a substitution for ambiguous or multiple option Hotstring text replacements. After typing one of the activation strings, a menu of alternative replacements pops-up. Since the Hotstring menus include many varied item lists, it made sense to create each only when needed. However, when I decided to combine a number of these menus into a group under one main menu, preloading the numerous static submenus seemed more practical. That left me with one problem. Some menus, such as current time and date insertion, need updating each time they pop up.

HotstringTimeDateMenu
The TimeDate submenu updates each time the top-level menu displays.

Once created, AutoHotkey menus sit idle as static tools waiting for the Menu, Show command—at least until deleted. While each subroutine called by a clicked menu item can produce variable results, the contents of the menu itself remain fixed. (Menu items do not accept variables as item names.) That means scripts which use the MenuItemName variable as dynamic output won’t update—unless the script deletes the menu items, then recreates them. If used as a submenu, the DateMenus.ahk script for inserting various current time and/or date formats into documents needs such an active menu. Continue reading

AutoHotkey Tip of the Week: Quick and Dirty Printing—September 30, 2019

If You Need a Hardcopy, Then You Can Use this AutoHotkey Print Technique—Plus a Cheap Way to Get Printer Ink

Library Benefits

Every once in a while you want to put something on paper. Most often, you open the appropriate program (i.e. a text editor or word processor for text documents, PDF viewer for PDFs, or graphics program for images) and print from that application. Trying to use AutoHotkey for direct printing can get pretty complicated (as discussed in Section 10.1.1 “Printing with AutoHotkey Made Simple” of the book Jack’s Motley Assortment of AutoHotkey Tips). But, for a quick printout, you can write an AutoHotkey line of code which sends a document to the printer from a program—without first opening the app.

Continue reading

Add Single-Key Shortcuts to QuickLinks App (AutoHotkey Quick Tip)

Reader Uses Menu Shortcut Keys to Speedup QuickLinks.ahk Action

Alan posted the following comment on Pressing GUI Buttons with a Single Keystroke (AutoHotkey Tip):

Hi, Jack,

Thanks for making such useful contributions to AHK.

I found QuickLinks to be useful but then was looking to make it even more helpful by having key shortcuts. I figured out how to do it! You can let others know if you can point out adding an ampersand in front of the letter of the folder or shortcut.

Thanks, 

Alan

*          *          *

I’m gratified that a number of people are using and modifying the QuickLinks.ahk script. It’s evolved considerably since I first introduce the barebones version in the book Digging Deeper Into AutoHotkey. In AutoHotkey Applications, I added icons using the Menu,…,Icon, command. In my most recent Motley Assortment of AutoHotkey Tips, I modified the script to add a number of other features. More recently, I wrote a blog which highlighted changes increasing the power of the script by another reader, “Open and Print Files with the QuickLinks App (AutoHotkey Tip from a Reader)“. In all that time, I never thought to talk about using the single-key shortcut menu technique available in all Windows menus with the QuickLinks.ahk script. Continue reading