New Intermediate Online AutoHotkey Course for Novices from “The Automator”

A New Udemy Course “Intermediate Autohotkey—Getting Past the Basics” from Joe Glines—Autohotkey Automation Guru

Not everyone learns in the same manner. Some of the best programmers I know taught themselves from scratch. They looked up the commands and figured out the rest themselves. They learn more advanced techniques by reviewing code written by other aficionados. While they do seek help for advanced topics, they don’t usually need beginning books or introductory courses. But, most people don’t fit into that category.

Continue reading

AutoHotkey Tip of the Week: Word Manipulating Dynamic AutoHotkey Hotstrings

A Mini-Regular Expressions (RegEx) Tutorial Using the RegExHotstrings() Function for Word Swapping and Double Word Auto-Delete

While the RegExHotstrings() function has its limitations (discussed in “Dynamic Regular Expressions (RegEx) for Math Calculating Hotstrings“), we can quickly implement some simple (yet complex) dynamic Hotstrings using a one-line function call. The RegExHotstrings() function offers a few advantages over the traditional Hotstring format. Regular Expressions (RegEx) used in the function bust through the fixed-text limitations of the double-colon format (e.g. ::lol::laugh out loud). RegEx allows you to match string patterns making wildcard text replacements possible. To explain how the RegExHotstrings() function works, I use one-line function calls to replace ambiguous text with targeted results.

RegExHotstrings

In order to make the best use of the RegExHotstrings() function, we need an understanding of the key concepts driving the function. Once we get a hang of how to operate this dynamic Hotstring function, we can analyze the parentheses-enclosed expressions in each example to develop a better grasp of how RegEx works.

In this blog, I highlight two different RegExHotstrings() function word editing operations: one for swapping the order of two errant words; the second for auto-deleting duplicate words. After introducing RegExHotstrings() key concepts, I explain step-by-step how each RegEx behaves.

Continue reading

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: 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: Use Regular Expressions (RegEx) to Convert Repetitious AutoHotkey Code

Regular Expressions (RegEx) Can Simplify a Tedious Code Reformatting Problem

Recently, I received the following comment from Thom:

Greetings,

A small improvement to the Autocorrect AHK script. I have been using this script for years and find it very useful. I was always a bit intrigued about the section of ambiguous entries which was commented out and not much use.

I was fascinated to read about your TextMenu function [found in the book Beginning AutoHotkey Hotstrings] to display the various choices. I found a simple way with RegEx to change all the entries in the section.

For example:

::electon::election, electron

To:

::electon::
  TextMenu("election, electron")
Return

I copied and pasted the list into Notepad++ and then ran this find-and-replace.

Find:

(::\w+::)(.+)

Replace:

$1\n TextMenu\(\"$2\"\)\nReturn

And presto it works—some entries need tweaking but it works well. Continue reading

AutoHotkey Tip of the Week: Increase the Flexibility of Menus by Passing Data with the BoundFunc Object

Streamline and Add Power to Hotstring Menus by Binding Action Parameters Directly to Each Menu Item

*          *          *

If you use AutoHotkey menus, then you may find this blog the most useful menu tip yet. At first, using the BoundFunc Object to pass data may seem confusing, but, once understood, it opens up many more opportunities for taking advantage of menus in your AutoHotkey scripts.

*          *          *

HotstringSubMenus

As often happens when working on an AutoHotkey script, a deeper understanding of the available tools completely changes the direction of the project. While all of the Menu tricks I’ve offered in the past HotstringMenu.ahk scripts still work (and you may want to continue using many of those techniques), the following approach which combines arrays, the variadic function parameter, and the boundfunc object creates a cleaner, more functional structure for generating Hotstring replacement menus. In short, implementing the boundfunc object allows me to drop many of those previous menu tricks and build menus using virtually any menu item format without regard for their later use through the value of the A_ThisMenuItem variable.

Continue reading

AutoHotkey Tip of the Week: Flexible AutoHotkey Hotstring Menus Using Arrays

New Parameters for the HotstringMenu() Function Adds Flexibility and Power to Pop-up Menus

In my last blog, I started looking at adding the variadic parameter (accepts multiple inputs) and a Menu subroutine parameter to the HotstringMenu() function. While in the process of creating alternative Label subroutines, I found that changing a subroutine often called for a new menu-creating function. Rather than resorting to multiple functions, I decided to add one more parameter for tailoring the master function.

CoverImage200
A Multitude of AutoHotkey Tips and Tricks

Note: This blog discusses the use of AutoHotkey object-based arrays (simple and associative) with the function’s variadic parameter. A review of my books demonstrated that most included discussions of arrays (pseudo-arrays and object-based arrays). In particular,  Chapter 12.1.5 “Using Associative Arrays to Solve the Instant Hotkey Data Recall Problem” in the book Jack’s Motley Assortment of AutoHotkey Tips explains the difference between the various array types while offering a practical example of an associative array.

Continue reading

AutoHotkey Tip of the Week: Use the Variadic Function Parameter for an Unknown Number of Values in Hotstring Menus

What To Do When You Don’t Know How Many Values You Will Use? For Hotstring Menus, the Variadic Function Parameter Allows a Variable Number of Arguments or Direct Array Input

Variadic Function: One which accepts a variable number of arguments.

MenuEmojiTagsLight Bulb!In the blog, “AutoHotkey Tip of the Week: Hotstring Menu Techniques for Inserting Symbols and Emojis“, I discussed switching from the deprecated StringSplit command to  StrSplit() function before posting the scriptAfter posting my new HotstringMenu.ahk script on the AutoHotkey forum, I received the following comment from the user Delta Pythagorean. I have mixed feelings about the recommended changes:

You can simplify this down by making the parameter variadic and letting the user chose which label to set the menu to work off of.

:x:brb::HotStringMenu("MenuLabel","Hello",,"Goodbye","See you later!")

MenuLabel:
  MsgBox, % "You said: " A_ThisMenuItem
Return

HotstringMenu(Handle, TextList*) {
  For Each, Item in TextList
    Menu, MyMenu, Add, % Item, % (Item != "") ? Handle : ""
  Menu, MyMenu, Show
  Menu, MyMenu, DeleteAll
}

I like the overall concept. This change to the HotstringMenu() function expands its capabilities by adding a selectable subroutine Label name and uses a variadic parameter which allows the functions to accept an unknown number of values. Continue reading

AutoHotkey Tip of the Week: Use ToolTips to Make Apps User-Friendly—August 26, 2019

Tip: By Applying the OnMessage() Function, You Can Include Windows ToolTip Notes in Your AutoHotkey GUI Window Scripts to Add Hints and/or Instructions Which Pop-up When Mousing-Over the Controls

Light Bulb!People might find some cleverly-designed AutoHotkey scripts confusing. Wouldn’t you like to add hints and tips which explain each control in your AutoHotkey GUI window? You can do just that with the ToolTip command and the OnMessage() function.

coverepub-250In the book AutoHotkey Applications, “Chapter Thirty-four: Pop-up Labels for All Your Programs (ToolTip Command)”, the Tooltip command highlights each control in an AutoHotkey GUI (Graphical User Interface) window. Use the ToolTip command to add helpful little informational notes to your AutoHotkey applications. Once you implement this tip, whenever you hover the mouse cursor over controls in an AutoHotkey GUI, the ToolTip command will identify the control’s function or give instant instructions (as shown below).

(Extra Tip: You can use this same technique with other non-AutoHotkey Windows application by identifying window and control names with Windows Spy or the WindowProbe.ahk script, then writing a short companion AutoHotkey script to work with the Windows program.)

ToolTipHelp
An AutoHotkey GUI shows three different ToolTips as the cursor is moved over each control.

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