AutoHotkey Quick Tip: Conditional Hotstrings Using the Input Command

Sometimes the Input Command Solves a Sticky Hotstring Problem

* * *

I promised an associative array tutorial for my next blog, but this topic intervened. I should have the tutorial ready for next Monday.

* * *

Recent comment on my blog “Auto-Capitalize the First Letter of Sentences“:

This routine can be handy, though the main issue is that, in AHK, “if more than one hotstring matches something you type, only the one listed first in the script will take effect”. Actually, I’m not sure about that, as it appears that using the asterisk as a hotstring option takes precedence. In any case, this does seem to have the effect that other hotstrings that could otherwise be used cannot be used if they also match the code provided here. I have lots of those types of hotstrings, which I use on new lines and after punctuation. I have been unable to find any solutions to this since AHK does not accommodate sequential firing.

A short demo:

:T:tn::Thanks
:C*?:`nt::`nT

Run this script. Type “Tn” on a new line. It works to type “Thanks”. Now type “tn” on a new line. The first line in the script is now skipped. You see only “Tn” in response.

Comment On “AutoHotkey Tip of the Week: Auto-Capitalize the First Letter of Sentences” by mikeyww

Whenever a Hotstring fires, it resets and waits for the next Hotstring. Therefore, the firing of the new line character and “t” (`nt) removes the letter “t” from the next string and starts over with the “n” character. The asterisk option (*) does not affect this behavior. It merely causes that Hotstring to fire before the first—then reset—prior to pressing the “n” key. However, I do appreciate the problem.

Continue reading

Parsing and Pasting One-Line Street Addresses (AutoHotkey Multi-Paste Trick)

Another Pet Peeve…the Windows Copy-and-Paste Doesn’t Make It Easy to Insert Street Addresses and Postal Codes into Forms

I’ve noticed that many applications and Web pages list street addresses on just one line:

Jack Dunning, 1234 Main Street, Any Town, MI  90571

This makes sense and saves space when compared to a three or four-line address listing:

Jack Dunning
1234 Main Street
Any Town, MI  90571

However, when using the Windows Clipboard for a copy-and-paste operation, a person still needs to jump between the two windows a number of times—unless he or she uses a parse-and-paste tool such as MultiPaste.ahk. Continue reading

Brute Force Data-Set Copy-and-Paste (AutoHotkey Clipboard Technique)

I Prefer an Eloquent Solution for Data-Set Transfer Problems, But Sometimes It’s Just Easier to Build a Simple (and More Universal) Copy-and-Paste Tool

*          *          *

I originally wrote the short script discussed in this blog to solve a single data transfer problem. Only after making the script functional did I realized that it could work in numerous different types of data-set transfer environments such as spreadsheets, Web tables, and many other information lists. This AutoHotkey script offers a little less tedious solution to common Windows cut-and-paste problems.

*          *          *

If I need to copy a single section of text into another document, then the Windows Clipboard works find. However, whenever I want to do something more complicated such as moving that same text into multiple data fields or copying data from a table in a document (or on the Web) before transferring it, using the Windows Clipboard can turn into a real hassle. Continue reading

Put Your Emoji Hotstrings in a Pop-up Menu (AutoHotkey Trick)

Unless Endowed with a Photographic 📷 Memory, Who Can Memorize All the Activating Texts ✍ for Over 1000 Emoji 😀 Hotstrings? Use This Menu 🍱 Technique to Find and Insert Emojis 😀 Taken Directly from Your Hotstring Script

Who wouldn’t want all the emojis available at their fingertips? The last blog “Add Emoji Characters to Any Windows Document (AutoHotkey Hotstrings)” does just that. However, with the exception of the icons you use all the time, you won’t find remembering the activating strings easy. We need a quick lookup table to remind us of the activating strings for each image. Even better, why not a pop-up menu which both gives us the Hotstring keys and inserts the emoji? Fortunately, we can do this with a short AutoHotkey routine which searches the original EmojiInsert.ahk Hotstring file for our favorite characters.

Continue reading

A Trick for Inserting Next Friday’s Date into Any Document (AutoHotkey Tip)

An AutoHotkey Technique for Determining Date for Any Coming Day of the Week, Plus a Pop-up for Picking Future Weekdays

“Do You Know Next Friday’s Date?”

We record upcoming events on our monthly calendars, but we live one week at a time. Most people work Monday through Friday and relax on Saturday and Sunday. If someone gives us a date for an occasion, we ask, “What day is that?”—meaning “Give me the day of the week.”

Continue reading

Italicize Your Hotstring Replacements with this Input Command Ploy (AutoHotkey Tip)

A Maneuver That Opts for Italic Output by Tricking the AutoHotkey Input Command, Plus a Tip for Creating Italic Hotstrings

In the past few blogs, I’ve explored using a data table to drive an AutoHotkey application featuring the enigmatic Input command. The article “Input Command Creates Temporary Hotstrings from Data Table (AutoHotkey INI File Technique)” demonstrates how to initiate access to a data table using the Input command. Following up, “More Hotstring Tricks Using the Input Command and a Data Table (AutoHotkey Legal Lingo Tips)” gives us an alternative menu generated from the data table when no match occurs in the Input command. With a simple modification of the AutoHotkey Input command, we add an option for converting the Latin legal terms into italics for particular word processors.

Blog Update, January 25, 2019: If your word processing software supports control key toggles such as CTRL+I for italics then you may want to take a look at “Adding Italics to Hotstrings in Word Processing Software (AutoHotkey Quick Tip).”

Continue reading

More Hotstring Tricks Using the Input Command and a Data Table (AutoHotkey Legal Lingo Tips)

The AutoHotkey Input Command Makes It Easy to Use the LegalInput.ini Data Table in Multiple Ways

A few weeks back I demonstrated how to build an INI data table for driving AutoHotkey scripts. I used the INI file format (LegalInput.ini) because it includes one index for quickly looking up records. In the file, I created four-character codes for accessing records which include the English legal definition, the Latin term, and a description (if any).

Legal Input Lex Scripta

While essential to the AutoHotkey feature discussed last time, you’ll find the INI file structure incidental to the technique discussed in this blog. You can use an INI file either for its index or as a standard data table with no special capabilities. As demonstrated in this piece, you’ll find a number of different ways to take advantage of a data table—without requiring an INI file. An INI file gives you a convenient means for quickly accessing data, but (especially for short files) you’ll discover numerous other methods for extracting the information you want. Continue reading

Input Command Creates Temporary Hotstrings from Data Table (AutoHotkey INI File Technique)

By Using an INI Table of Legal Terms, We Construct Instant Hotstrings with the AutoHotkey Input Command

I recently received questions about using AutoHotkey for professional terminology in medical transcription. While features in many word processors such as Microsoft Word allow the building of special auto-correct dictionaries, they only work within Word. Since AutoHotkey works anywhere on a Windows computer, it’s only natural to want your own specialized technical lexicon. However, for the newbie, the question turns into “Where do I start?” Continue reading