Total the Numbers Found in Any Document (AutoHotkey RegEx Tips Part 5)

For a Quick-and-Dirty Calculator, Use Regular Expressions (RegEx) to Pull Numbers from Documents or Web Pages and Total Them Up—Plus, a RegEx for Removing (or Extracting) Numeric IP Addresses

Shifting gears, I end the discussion of the MultiPaste.ahk script which parses copied data into component parts for easier paste operations into other documents. With this blog, I start working on another tool for simplifying a Windows task—addition.

Sometimes I see a list of numbers in either a document or a Web page which I would like to quickly total without loading a separate calculator. For example, the shopping cart program I use for my book sales offers a summary table of all recent sales. While I can use a reports section of the site to get more information (e.g. monthly sales), I want a tool to quickly highlight the desired entries and give me the total of the individual sales. To do that I use a Regular Expression (RegEx) specifically for extracting those sales numbers. Continue reading

Removing Excess Tabs and Spaces with RegEx Greed (AutoHotkey RegEx Tips Part 3)

After Parsing Selected Table Data or One-Line Street Addresses for Unique Paste Operations, We Prevent Blank Paste Items from Appearing in the MsgBox Window by Using RegEx Greed to Remove Any Extra Tab Characters

In the first two parts of this series, I introduced a couple of common Regular Expressions (RegEx) wild cards for finding unknown characters (the needle) in a larger string of text (the haystack). In “Finding US Zip Codes (AutoHotkey RegEx Tips Part 1),” I discussed the \d expression (representing any single numeric digit) which you can also identify with the range [0-9] or the expression set (0|1|2|3|4|5|6|7|8|9).

In “Finding UK Postal Codes (AutoHotkey RegEx Tips Part 2),” I introduced the wild card \w as the RegEx symbol for matching any alphanumeric character (upper or lower case) and the ten digits (plus underline mark)—the equivalent of the range [a-zA-Z0-9_]. In both blogs, I used the /s wild card to locate a space in front of either the US zip code or UK postal code.

This time I use \s in combination with `t to remove extra tab delimiters (e.g.`t`t) which insert blank lines in the MultiPaste.ahk script’s MsgBox command window.

Continue reading

AutoHotkey Script Speed Problems (Scripting Insights)

When Debugging AutoHotkey Script Speed Problems, Look at Loops First

A number of scripting techniques can cause apps to run slowly. These slowdowns might occur when running long loops, doing extensive searches, or making numerous hard drive reads and writes. But the primary culprit tends to hide within loops or redundant operations of any type. However, you may need to look deeper to find the real source of the problem.

Tip: If you like to keep numerous other programs open, then that alone can cause significant slowing as your computer shares processing time. For example, Google Chrome runs an independent process for each browser tab. Multiple Google Chrome tabs can put a heavy load on the CPU and memory causing delays in any other apps. To optimize time tests, minimize interference by closing all other programs.

Continue reading

Use Progress Bars When Loading Large Data Files (InstantHotstrings Feature)

Long Load Times Make Us Wonder If Our Computer Has Crashed—Progress Bars Help Us Stay Patient

In the blog, Use the FileSelectFile Command to Save Instant Hotstrings to an AutoHotkey File, I discussed how the InstantHotstring.ahk script saves a set of newly created Hotstrings to a data file. The flip side of the coin reads those same (or any other) Hotstring data files into the InstantHotstring.ahk script, (Loading Hotstrings into the InstantHotstring.ahk Script from Any AutoHotkey (.ahk) File). The solution to reading Hotstring files introduced the problem of the long load times for large files (Timing Script Speed). Continue reading

Timing Script Speed (AutoHotkey Quick Tip)

Certain Types of Subroutines Tend to Eat Up Time (Loops, On Screen Changes, Multiple Drive Accesses, etc.)—Use This Simple Timer Routine to Figure Out How to Increase AutoHotkey Script Speed

Anytime you use AutoHotkey to make iterative changes in the controls in a GUI (Graphical User Interface) pop-up window, force multiple access to hard drive files, or implement repetitious subroutines (almost always with some form of a loop), you run the risk of slowing down your scripts. Minor changes to your script can make a significant difference in how fast it runs. 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