Jack’s AutoHotkey Blog

Get Free AutoHotkey Scripts!
Two Locations!

ComputorEdge Free AutoHotkey Scripts Page
or ComputorEdge Software Showcase

The Best Type of Brain Food!
Get Started with AutoHotkey with These Books!

autohotkeybooks670x83

*          *          *

Library Benefits

November 11, 2019

Light Bulb!AutoHotkey Tip of the Week: Hotstring Menu Techniques for Inserting Symbols and Emojis

November 4, 2019

Light Bulb!AutoHotkey Tip of the Week: AutoHotkey Hotstring Menus for Text Replacement Options

October 28, 2019

Light Bulb!AutoHotkey Tip of the Week: Understand How Hotstring Activating Text Works

October 21, 2019

Light Bulb!AutoHotkey Tip of the Week—Powerful RegEx Text Search Shorthand (~=)

October 14, 2019

Light Bulb!I only recently learned that you can do this! “AutoHotkey Tip of the Week: Embed Images Directly in the AHK Script.”

October 7, 2019

Light Bulb!AutoHotkey Tip of the Week: Add Power to Any Command with Forced Expressions (%)—October 7, 2019

September 30, 2019

Light Bulb!Print with AutoHotkey the easy way, “AutoHotkey Tip of the Week: Quick and Dirty Printing—September 30, 2019.” Plus, a cheap way to get printer ink.

September 23, 2019

Light Bulb!

Add Hotkeys to your pop-up windows which only activate when the window exists, “AutoHotkey Tip of the Week: Add Temporary Hotkeys to MsgBox Windows—September 23, 2019“.

September 16, 2019

Light Bulb!This week “Add Single-Key Shortcuts to Pop-up Menus,” plus a trick for formatting code using Ryan’s RegEx Tester.

September 9, 2019

Light Bulb!Instantly reverse errant characters, “AutoHotkey Tip of the Week: Auto-Swap Transposed Letters—September 9, 2019.”

September 2, 2019

Light Bulb!

Too much text capitalize (or not)? Rather than retyping entire lines of text try this AutoHotkey Tip of the Week: Instant Upper Case, Lower Case, and Initial Cap Text—September 2, 2019.

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.)

Continue reading

AutoHotkey Tip of the Week: Hotstring Menu Techniques for Inserting Symbols and Emojis

Place Special Characters and Emojis in Hotstring Menus to Make Them Easy to Find for Inserting into Documents, Plus Sample Hotstring Special Character Menus

MenuEmoji
Hotstring Menu

In my last blog, “AutoHotkey Hotstring Menus for Text Replacement Options“, I expanded upon the Hotstring menu technique discussed in Chapters Eight and Nine of my book Beginning AutoHotkey Hotstrings. While the menus work great, I noticed that, in many instances, the standard built-in Windows menu objects do not always make it easy to distinguish various characters. For example, when I placed a mix of symbols and emojis in a menu, it produced ambiguous results:

:x*?:b``::TextMenu("🦄,🐀,🐁,🐂,🐃,®,❓,❔")

The characters appear small in the menu (shown at right above)—often without clearly defined differences.

In the menu, the rat (🐀) and mouse (🐁) seem very similar—as do the ox (🐂) and the water buffalo (🐃). The two question marks at the end of the menu look identical, although, the first emoji inserts the punctuation mark in red (❓) while the second adds a white question mark (❔). We need another method for discriminating between the menu options. Continue reading

AutoHotkey Tip of the Week: AutoHotkey Hotstring Menus for Text Replacement Options

Put Hard-to-Remember AutoHotkey Hotstring Replacements in a Menu

Beginning AutoHotkey Hotstrings 200px

Light Bulb!

This tip expands on Chapter Eight of my book Beginning AutoHotkey Hotstrings, “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.” You can use these techniques in your AutoHotkey scripts to make the selection of similar Hotstrings easier to remember by selecting from a menu. Continue reading

AutoHotkey Tip of the Week: Understand How Hotstring Activating Text Works

Sometimes We Limit Our Scripts by Not Grasping How AutoHotkey Features Respond

In AutoHotkey, we use Hotstrings for automatic text expansion and replacement—as in the extensive list of common misspellings found in the AutoHotkey AutoCorrect.ahk script. After loading this series of Hotstrings, if you misspell one of these words, AutoHotkey instantly corrects it. I’ve included this as a standard part of my main AutoHotkey script and often watch the Hotstrings in action when they correct one of my typos or misspellings.

Beginning AutoHotkey Hotstrings 200pxWhenever a Hotstring fires, it resets and waits for the next one. Most commonly, this occurs when we type a space, period or other punctuation as a Hotstring recognizer. One might fall prey to the misconception that every such space or punctuation key press causes a Hotstring reset, but not so. Hotstring monitoring only resets when a Hotstring event occurs (or with a mouse click or cursor movement). That means we can include spaces and punctuation in the activating strings (or Hotstring definitions) which appear after the first double-colon.

Light Bulb!Most AutoHotkey users might understand this fact about Hotstring activators, but I write about it here for those of us who either never fully realized the importance of this aspect of Hotstrings or we just forgot. Knowing this fact allows for a number of additional types of Hotstrings rather than limiting ourselves to standard text expansion and replacement. A perusal of the AutoHotkey AutoCorrect script lets us peek into how we can take advantage of this aspect of Hotstrings. Continue reading

AutoHotkey Tip of the Week—Powerful RegEx Text Search Shorthand (~=)

AutoHotkey Provides an Abbreviated Regular Expression RegExMatch() Operator ( ~= ) for Quick Wildcard Text Matches

Regular Expressions (RegEx) can get confusing, but once understood, they pay tremendous dividends. Acting almost as another programming language, Regular Expressions in AutoHotkey provide a method for accomplishing complex search and/or replacement with only one line of code. While not impossible, doing the same thing without using RegEx often requires complex tricks and many lines of code. In the beginning, learning RegEx many feel daunting but you’ll find it well worth the journey.

Light Bulb!In spite of the initial learning curve, you don’t need to learn how the two primary AutoHotkey RegEx functions work (RegExMatch() and RegExReplace()) to make good use of a RegEx. The shorthand RegEx operator ( ~= ) provides a method for doing a complex string match without the limitations of the InStr() function. Regular Expressions search for patterns while the InStr() function searches for exact strings.

Continue reading

AutoHotkey Tip of the Week: Embed Images Directly in the AHK Script

Rather than Use the FileInstall AutoHotkey Command, This Trick Allows You to Lodge Images Directly into Your AutoHotkey Scripts

Light Bulb!In the past, whenever I wanted to add a graphic image to an AutoHotkey script, I needed to either separately provided the file or embed it in the compiled EXE file using the FileInstall command. The AutoHotkey world has opened my eyes to an ancient technique for embedding an image directly in the AHK script—no need to supply the file separately or embed it by compiling the script. Continue reading

AutoHotkey Tip of the Week: Add Power to Any Command with Forced Expressions (%)—October 7, 2019

Use the Forced Expression Operator (%) to Adapt AutoHotkey Commands On-the-Fly

Light Bulb!Most AutoHotkey Version 1.1 commands use plain text as parameters. That means AutoHotkey interprets the text exactly as written—no quotes needed and no variables accepted. In version 1.1, this would limit the commands except for the availability of the traditional (or legacy) double-quote text replacement operator (%var%).

The %var% technique allows us to substitute any variable directly into an AutoHotkey command. However, using the forced expression operator (%) adds even greater flexibility and power to almost any AutoHotkey code. In many cases, rather than developing complicated subroutines, you can use this technique to embed expressions and functions directly into version 1.1 AutoHotkey commands. 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