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

Pasting Date Parts into Forms (AutoHotkey RegEx Tips Part 4)

In Most Data Fields, You’ll Find It Simple to Paste Text or Numbers, But Inserting a Parsed Date Often Requires Extra Steps—Plus How to Change Date Paste Action Based on the Active Window Title

In the first three blogs of this RegEx series, I used Regular Expressions (RegEx) to identify and parse data prior to any paste operations. In this blog, I use a RegEx to identify and parse dates during the multi-part date paste operation. I use the previously introduced \d wild card (any numeric digit zero through nine) and the optional match modifier (the question mark ?), plus, I introduced how to create a selection list of possible matches by using a range of options (in this case, a forward slash, a dash, or a dot [/\-.] as date separators).

*          *          *

Cover 200When working with forms, dates often use three separate data entry fields—one for the month, one for the day, and one for the year. (In the UK, they swap it around to day/month/year.) In some forms, you need to enter a forward slash (/) to jump to the next entry item. Sometimes the form automatically jumps to the next field after entering two digits. In many Web pages, you need to tab between each data entry area. Sometimes, sending the entire copied date as a single string works.

Since I wrote the MultiPaste.ahk script to respond to a particular personal finance program, I set it up to Send the date delimited with slashes. If you want to do something similar for a different software package or Web page, then you may need to tailor the script. This blog shows you how to do that. 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

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

Username and Password Protection in AutoHotkey

While You Won’t Find Absolute Password Protection, There Are a Number of Techniques Available to Help Hide Your Secrets

Computer security is one of the major issues of these times. How do we protect our data? Even after all of the latest innovations in cybersecurity, we hear about hacks of major sites and institutions. With all the ways we use today’s computers, we want to feel as safe as possible.

Caution: Human error (e.g. opening the wrong attachment, not changing passwords, etc.) offers the number one opportunity for the bad guys to invade your privacy. If someone gains access to your computer, then you have virtually no protection. Some people either don’t add a password to their Windows computer or allow autologin when the machine boots up. That’s a mistake! Always require password login to access your Windows computer. Otherwise, you make it too easy for people who stumble upon your computer—either in your office or cyberspace. Continue reading

E-mail the Daily Horoscope to Yourself (AutoHotkey Trick)

Combining the Daily Horoscope from the Web with this AutoHotkey E-mail Sending Technique Makes It Possible to Deliver the Prescription to Anyone

In recent blogs, I discussed how to extract data from a Web page (“Quick and Dirty Web Data Extraction Script“) and send an e-mail directly from an AutoHotkey script (“How to Send E-mail Directly from an AutoHotkey Script“). This time I put them both together to demonstrate how to deliver a daily horoscope to yourself (or a friend).

HoroscopeEmail.pngE-mail—the oldest and most universal method for reaching people—offers a major advantage over text messages and other digital forms of communications (e.g. Twitter, Facebook). Most people own at least one e-mail address which they can access from any of their computers (PC, Mac, or Linux), any smartphone (iPhone or Android), or tablet. To send an e-mail, you don’t need to know a phone number or the type of device. E-mail servers push the message directly to the target addressee. Plus, using AutoHotkey, you can automate the periodic sending of an e-mail. Continue reading

How to Send E-mail Directly from an AutoHotkey Script

Using Windows CDO COM, You Can Send E-mail Without Opening Your E-mail Program

RobotEmailCartoonIn my last blog, I wrote a short script for extracting data from a Web page without using a Web browser (“Quick and Dirty Web Data Extraction Script“). As a demonstration, I showed how to quickly download and cull a daily horoscope from an astrology site for display in a MsgBox window. It occurred to me that rather than using a Hotkey each time I wanted to view my horoscope, I would prefer to receive it each morning in an e-mail. That way I could set up the script to run automatically and push the data to me at the same time every day. Plus, I can view an e-mail on any device (e.g. smartphone, tablet, or non-Windows computer) without any special programming. This requires sending an e-mail via an AutoHotkey script. Continue reading

Quick and Dirty Web Data Extraction Script (An Easy AutoHotkey RegEx Trick)

A Simple Regular Expression (RegEx) Retrieves Your Daily Horoscope by Harvesting Data from a Web Page—This 10-Line AutoHotkey Script Demonstrates How to Build Your Own Web-Based Pop-ups

Regular Expressions (RegEx) can get pretty complicated, but for this desktop trick, you only need to learn one short wildcard expression. Anyone can implement this simple pop-up window trick—displaying virtually any selected data found on the Web without loading a browser. Perhaps you would like a message box displaying the current weather. Or, maybe you want to read your daily horoscope. If it’s on the Web, then you can probably turn it into a quick AutoHotkey app.

As a demonstration (and possible template for other pop-up apps), I’ve written a short script which, without a browser, accesses an astrology Web page and displays my daily horoscope in a Windows message box. You can find the code for this Horoscope.ahk script at the end of this blog.

Continue reading