AutoHotkey Tip of the Week: Dynamic Regular Expressions (RegEx) for Math Calculating Hotstrings

An AutoHotkey Classic, the Dynamic Hotstrings() Function Makes Instant RegEx Replacements Possible—Now, You Can Do Math with Your Hotstrings!

Anyone who reads my blog on a routine basis knows how I love Regular Expressions (RegEx). They make feasible all kinds of capabilities not practical by any other method. While not necessarily easy for a beginner to grasp, RegEx provides a mechanism for matching text when you don’t know exactly which characters you need (wildcards). (That’s why I wrote the book A Beginner’s Guide to Using Regular Expressions in AutoHotkey.) Although you may encounter a bit of a learning curve, RegEx gives you the ability to accomplish some pretty fancy tasks. This time I plan to demonstrate a couple of Hotstring techniques that might amaze you—they did me! Continue reading

AutoHotkey Tip of the Week: AltSubmit Prevents One-Click Field Editing in GUI ListView Control

Sometimes Adding More Capabilities to a GUI Eliminates Other Features


Chapter Ten “More To-Do List App (Resizing and Positioning the GUI)” of  the AutoHotkey Applications book discusses “Direct Editing in the First Column Field of ListView.” This convenient feature mirrors the one-click editing you get when working with Windows File Explorer—the same effect as selecting Rename from the right-click context menu or hitting the F2 key. The feature makes it easy to change the name of a file or folder. I find this technique much simpler than editing text in a separate edit field then clicking an Update button, however, you can accidentally disable one-click editing in a GUI ListView when attempting to add other useful features by including the AltSubmit option. Continue reading

AutoHotkey Tip of the Week: Add Single-Key Shortcuts to Pop-up Menus—September 16, 2019

Sometimes It’s Just Easier to Use the Keyboard Rather Than Your Mouse

HotString Pop-upIf a menu busts in while typing, it forces you to switch to your mouse for resolution. This can get pretty annoying if your script uses a number of pop-up menus. For example, Chapter Eight, “Make Your Own Text AutoCorrect Hotstring Pop-up Menus with AutoHotkey” and Chapter Nine, “How to Turn AutoHotkey Hotstring AutoCorrect Pop-up Menus into a Function” of the book Beginning AutoHotkey Hotstrings shows you how to set up a list of alternative corrections. It works well for offering options but, at times, wouldn’t you prefer to hit a single key to make the selection rather than first fetching the mouse, then clicking?

Recent Question from a Reader:

Is there any way to improve the script in order to, once the menu appears, select an option using a given key combination?

For instance: If I typed “alt+1” AutoHotkey would automatically select the option “again”, if I typed “alt+2” it would select the option “a gin” and so on so forth until alt+0?

*          *          *
Continue reading

AutoHotkey Tip of the Week: How to Combine Multiple Scripts into One—August 19, 2019

Design Your Scripts to Either Run as Stand-alone Apps or Use the #Include Directive to Integrate into a Master Script without Modification

Light Bulb!Cover 200 Border

The cool thing about this tip is that, after you implement these techniques—without any additional changes—you can run your AutoHotkey script as an independent app or quickly add it to a master script. 

In “Chapter Eleven: How to Write Easy-Merge AutoHotkey Scripts” from the book Beginning Tips for Writing AutoHotkey Scripts, I outline steps for writing scripts which easily combine with other scripts without conflict. This allows the AutoHotkey user to run multiple apps without needing to launch each script individually. (It also prevents the accumulation of numerous AutoHotkey icons in the Windows System Notification Tray.) If you employ these basic design tips when writing your apps you’ll find that you don’t need to do any rewrites when combining useful scripts. Continue reading

Add Action to Your Hotstrings Using the New X Option (AutoHotkey Tip)

The Hotstring X Option Offers More Power by Running Commands, Functions, and Subroutines, Plus How to Temporarily Block External Hotstrings

In February of last year, the powers-that-be added a new Hotstring() function and a number of other Hotstring related features (See “New Flexible Hotstring Features Added to AutoHotkey.”) This major change added a host of new possibilities for creating and manipulating Hotstrings. The Hotstring() function acted as the impetus for my InstantHotstring.ahk script. In the process of writing that app, I developed a better understanding of how to enhance Hotstrings. Getting immediate feedback when implementing new replacements and options allowed me to quickly investigate many possibilities. Continue reading

Using GUI Checkbox Controls to Set Hotstring Options (AutoHotkey Technique)

AutoHotkey Hotstrings Use a String of Characters to Turn Options On and Off—GUI Checkbox Controls Offer a Visual Display for the Active Options along with a Method for Enabling/Disabling Each Feature

Previously (in “The Coming Instant Hotstring Script (AutoHotkey App)“), we reviewed the work still needed in the InstantHotstring.ahk script. This time we implement Hotstring options using the Hotstring() function.

Converting GUI (Graphical User Interface) Checkbox controls into Hotstring options codes (and back again) involves adept programming tricks. We use GUI windows and their controls to make applications user-friendly. People find it much easier to push discreet buttons and check separate boxes than work directly with often enigmatic programming codes. That means we must build a method for translating between the user-friendly input in a GUI window and the required code. Continue reading

Using the AutoHotkey Hotstring() Function to Disable/Enable Hotstrings

While the Hotstring() Function Won’t Delete Hotstrings, It Can Toggle Them Off and On (Disable and Re-Enable)

Technically, once created, you can’t delete a Hotstring without exiting the script. However, you can disable and enable its function. When you disable a Hotstring using the Hotstring() function, it loses its power—similar to the effect of deleting it. But, since the disabled Hotstring still exists, you can bring it back to life by re-enabling it with the same Hotstring() function. Continue reading

Create Instant Hotstrings Using the AutoHotkey Hotstring() Function

While Building Temporary Hotstrings Using the AutoHotkey Hotstring() Function, We Learn DropDownList GUI Control Techniques

In Section 12, “Instant Hotkey GUI and Menu Section” of my book Jack’s Motley Assortment of AutoHotkey Tips, I go through a number of different techniques for keeping track of impromptu Hotkeys created with the InstantHotkey.ahk script (e.g. two-deep variables, associative arrays, etc). I thought of using that script as a model for this new InstantHotsting.ahk script. However, I might offer more learning points about other aspects of AutoHotkey if I start over with a new approach to this slightly varied problem.

Continue reading

New Flexible Hotstring Features Added to AutoHotkey

Last February, AutoHotkey Release Included Important New Hotstring Capabilities

A few months back while working on my latest book, Jack’s Motley Assortment of AutoHotkey Tips, I encountered a new x option for Hotstrings. The x option enables the running of functions and commands rather than replacing text. This new feature surprised me since, in the past, a one-line Hotstring would only do text replacement.

I immediately recognized that this approach to one-line action Hotstrings could immediately shorten a long list of function Hotstrings. However, closer scrutiny of the new AutoHotkey release revealed further (and possibly more important) new Hotstring functionality. In addition to the x option, the February AutoHotkey release includes:

  1. A new Hotstring() function which adds dynamic capabilities to Hotstrings.
  2. A new method for creating function Hotstrings by defining the function immediately after the Hotstring(s).

Continue reading

Pressing GUI Buttons with a Single Keystroke (AutoHotkey Tip)

Sometimes We Find It Easier to Hit a Key Rather Than Click a Button

An AutoHotkey forum user posted a question about using Hotkeys to activate buttons in a GUI window. He wanted to hit the numbers 1, 2, 3, or 4, rather than clicking the individual buttons—but only for the active GUI window.

hotkeycover200While I discuss similar isolation of Hotkeys to specific active windows in my Hotkeys book, this blog provided another opportunity to show how to add more functionality to your GUIs without infringing upon other programs or Hotkeys. I attempted to make the script as simple as possible by using a number of AutoHotkey tricks. Continue reading