AutoHotkey Tip of the Week: The Eval() Function for Hotkey Math Calculations and Text Manipulation

The Classic Eval() Function Solves Problems You Didn’t Even Know You Had by Calculating and Resolving AutoHotkey Functions and Expressions Found in Text Strings!

When I work on particular AutoHotkey solutions, often I find myself in the middle of a treasure hunt—picking up hidden gems along the way. Although operative for years, I didn’t know these valuable tools existed until I went searching for answers to a seemingly unrelated problem.

EvalfunctionMsgBox2For example, the simple question about capitalizing sentences led me to the RegExHotstrings() function discussed last time. As I dug deeper into the math-side of dynamic Hotstrings, I discovered the Eval() function. While many old AutoHotkey hands have employed the Eval() function for years, I didn’t understand its power until I used it in the investigation. (Even now the Eval() function does way more than I comprehend. I’ve only scratched the surface of its capabilities.) Continue reading

AutoHotkey Tip of the Week: Auto-Swap Transposed Letters—September 9, 2019

Tip: Fix Reversed Letter Typos with this Simple Hotkey Trick

SwapLetters
Place the cursor between two letters and hit the Alt+R Hotkey combination. The letters reverse positions.

Light Bulb!I use this Hotkey whenever my mild dyslexia kicks in and leaves me with swapped letters. My AutoHotkey AutoCorrect.ahk script may catch many such errors but many more make it on to my computer screen. I could have written a Hotkey routine which swapped pre-selected (highlighted) letters, but, rather than taking the time to select the characters by dragging the mouse across them, I wanted to merely place the cursor between the two errant letters.

This use of the Send command makes it incredibly easy to transpose any two letters. Simply place the cursor between them and hit ALT+R (as shown in the figure.)

Continue reading

AutoHotkey Tip of the Week: Instant Upper Case, Lower Case, and Initial Cap Text—September 2, 2019

Tips: Quick Hotkeys for Changing Text To/From Capital Letters and How to Initial Cap Everything, Plus, How to Write Robust Clipboard Routines

Light Bulb!This week I offer two useful tips: one for editing text and the other for improving your AutoHotkey scripts.

When reviewing my books, I look for those tips which I use all the time. I’ve found that I developed some scripts primarily for demonstration purposes and rarely ever use them again. Yet, I have a few which I use so much that I feel like they have become a part of my Windows system.

AHKNewCover200In this case, while perusing my Beginner’s Guide to AutoHotkey, I noticed in “Chapter Four: Hotkeys and Text Editing with Windows Clipboard” the Hotkeys for changing selected portions of text into all capital letters, all lowercase letters, or initial cap every word in the section. I originally wrote these Hotkeys when I edited articles submitted by freelance writers.

Some writers have a penchant for placing their article headlines and topic subheadings in all uppercase letters. By creating a Hotkey for converting the entire line to Title Mode (initial capital letter for each word), I quickly solved the retyping problem:
Continue reading

Finding UK Postal Codes (AutoHotkey RegEx Tips Part 2)

By Comparison, UK Postal Codes Offer a Greater Challenge Than US Zip Codes When Writing Regular Expressions (RegEx)

UKPostalCode
Note that a single space appears between “Birmingham” and the “B5 5QD” postal code. Without special recognition of the UK postal codes, the MultiPaste.ahk script won’t create a separate paste item.

In the previous blog (“Finding US Zip Codes (AutoHotkey RegEx Tips Part 1)“), I began this mini-tutorial series on AutoHotkey Regular Expressions (RegEx) with a technique for parsing US zip codes from street addresses. For the MultiPaste.ahk script to work best (“Parsing and Pasting One-Line Street Addresses (AutoHotkey Multi-Paste Trick)“), I needed any zip code to appear as a separate paste item in the MultiPaste MsgBox. The parsing problem occurs because most one-line address formats only use as a delimiter the space character (no comma or newline) between the state and zip code. The same holds true for UK postal codes.

Cover 200Last time, I pointed out how the string functions—InStr() and StrReplace()—require exact search characters while the Regular Expressions functions—RegExMatch() and RegExReplace()—can use a variety of wild cards to represent characters. In fact, the various different ways to express wild cards cause a degree of confusion. In this blog, I introduce the \w alphanumeric wild card and the question mark modifier (?) to create optional matches. 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

Build Your Own Dream Thesaurus Word Replacement Tool (AutoHotkey Web Application)

How to Use the Web to Feed Data to Your AutoHotkey Application—A Pop-up Menu to Replace Boring Words in Your Documents

Synonym Page
I highlight any word and hit the CTRL+L Hotkey combination. AutoHotkey downloads the code from the target Web page and parses the synonyms using RegEx—placing each in a pop-up menu. Click on any item and AutoHotkey replaces the selected word in any document or field open for text editing. In the example, the menu lists possible replacements for the word •PAGE—the first item in the menu. Click •PAGE to open Thesaurus.com at the target location.

I immediately added this short AutoHotkey script to my primary toolbox. It immediately provides me access to a list of alternative words in menu form (shown at right). Click on one of the entries and it instantly replaces the previously highlighted word. The apps beauty lies in the fact that I can utilize the Web for the database of synonyms. The script extracts the menu items directly from a Theraurus.com Web page without opening my Web browser or processing any of the code—no ads. For writers and editors (or anyone who wants to expand their vocabulary), this one script provides enough incentive to plunge into regularly employing the free AutoHotkey Windows utility language.

If Theraurus.com ever notices, I suppose this script may not make the owners of the site very happy. Any revenue they derive comes from the advertising. My app ignores all of it. They could change the formatting of the page, but then I would adjust the Regular Expression I use to extract the data. They might make an attempt to block my efforts, but I guess any such blocking technique would also block regular users. They could block my IP, but that would be a lot of work for just one person. (I would simply switch to another site offering synonyms.) In any case, I plan to continue using this AutoHotkey script until it stops working—for whatever reason. Then, I’ll fix it. Continue reading

Swapping Dyslexic Letters (A Favorite AutoHotkey Trick)

Sometimes the Little Things Remind Me How Much I Like AutoHotkey

As I worked on one of my blogs, I accidentally transposed two letters (probably “form” for “from” or vice versa). I placed the cursor between the errant letters and hit the R key while holding down ALT. The two characters exchanged position. Pleased with myself, I decided to highlight the letter-swapping Hotkey combination in this blog as one of my favorites.

Continue reading

Accessing Web Pages (AutoHotkey Tips)

Find a Consistent Relationship in URLs to Redirect Web Pages

A while back I wrote a script which accessed the AutoHotkey online documentation quickly bringing up information about commands and variables. It took advantage of a hidden index in AutoHotkey.com which loaded key pages. However, as happened at the time, relying upon that index does not guarantee access. As with any Web page, things change.

The online documentation is currently going through some modifications. Possibly, in preparation for future use with the coming AutoHotkey version 2.0, we see a number of new revisions. With those alterations, the secret index has once again disappeared. That means much of my earlier work no longer functions as designed. I’ve decided to completely redo my AutoHotkey reference app with the following goals:

  1. Drop reliance on any hidden index to quickly return AutoHotkey command and variable information.
  2. Add simultaneously support for both AutoHotkey V1.1 commands and the parallel V2.0 functions.
  3. Add support for locating changes in V2.0 not directly correlating with V1.1 commands.

Continue reading