Swapping Variable Values (Beginning AutoHotkey Tip)

Rather Than Rewriting Code, Sometimes You’ll Find It Easier to Swap Variable Values

You may not need to use this technique very often but when you do, it can save you a lot of time.

Calculating Years, Months, Days Problem

I wrote the HowLong(FromDay,ToDay) function to calculate the difference between two dates in years, months, and days. The way the function operates it starts at the first date (FromDay) and works its way forward to the second date (ToDay). If the first date occurs after the second date, the function yields bad results.

HowLongOriginally, I added a trap to notify the user when the first date occurred after the second date—offering an opportunity to try again. However, I eventually realized that I only needed to reverse order of the dates to yield the right answer. Rather than rewriting a ton of code to create a backward-looking function, I left the original logic untouched by swapping the two date values when in reverse chronological order. Continue reading

New Book of Jack’s Motley Assortment of AutoHotkey Tips

 

Jack’s Motley Assortment
of AutoHotkey  Tips

A Living Book

CoverImage200This first edition of my new book Jack’s Motley Assortment of AutoHotkey Tips includes more than 80 chapters of AutoHotkey tips, tricks, and techniques. But, that only reflects the starting point for this Living book. Every six months to a year, I will add 30 or more new chapters based upon my current explorations of AutoHotkey. If you purchase this book, you will get all of these new editions free. You only need to buy this book once.

To review the “Table of Contexts” and “Index”, see this Motley Tips page. Continue reading

Add Emoji Characters to Any Windows Document (AutoHotkey Hotstrings)

Why Search Through Pop-up Tools When You Can Directly Enter Any Emoji into Your Documents, E-Mails, and Web Editing Windows with AutoHotkey?

“I went to the 🏖 on a 🌞day. The 🌞 was so 🔆 that I needed to wear 🕶. I was lucky enough to see a 👩 in a 👙🖐 to me. I saw 🌊s, ⛵s, 🌈s, and a 🦄. Maybe, I had a few too many 🍻s.” 🙄

Years ago I wrote about an AutoHotkey app called WinCompose: a Robust Compose Key for Windows which adds special characters to any Windows document or Web editing field. It appeared to use the Input command in conjunction with a “Compose” key to enter memorable keystrokes for inserting special characters. WinCompose has since converted to a different programming language and added emoji support. Similar to emoticons, emojis add special cartoon-like pictograms to your documents. Unlike emoticons, many programs recognize emojis—as long as the software includes UTF-8 support. 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

A Beginner’s Guide to Understanding AutoHotkey If Statements

It Can Get Pretty Confusing When Considering Which AutoHotkey If Conditional to Use

Occasionally, when updating or modifying a script I run into a problem where an If conditional just stops working. At first, I experience the usual confusion, but, eventually, it occurs to me to enclose the subject of the conditional in parentheses. The code starts working again. How does this happen? 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

Jack’s New Beginner’s Guide to AutoHotkey

Completely Rewritten, Jack’s New Beginner’s Guide to AutoHotkey Includes Peeks at AutoHotkey Version 2.0

In July of 2012, I first starting digging into AutoHotkey. Originally, I put AutoHotkey in the class of “just another Windows scripting language.” But as I delved deeper and deeper, I soon realized that it had assumed the mantle of probably “the best utility software to ever DeprecatedRobothit Windows.” Not only does AutoHotkey immediately automate many simple Windows tasks, but it includes the powerful commands and functions you might find in any programming language—and much more. Six years later, nothing has changed my mind. In fact, as I learn more about AutoHotkey through my blogging and books, I get even more convinced that AutoHotkey offers “absolutely the best free Windows utility software ever!” Continue reading

AutoHotkey Version 2.0—Should I Wait for It?

ComputorEdge E-Books

As Signs of the Impending Release of AutoHotkey V2.0 Crop Up in the Online Documentation, Questions Arise About Our Legacy Scripts

I start by admitting that I have no special insight into AutoHotkey V2.0. I’ve had no contact with anyone who has the answers. I base all my thoughts on information freely available in the online documentation, forums, and other AutoHotkey sources. You might consider my words rank speculation—although drawn from my years of working with AutoHotkey V1.1. Since I written so many AutoHotkey books, you could even say that I hold a vested interest in the current version of AutoHotkey. In spite of all that, I offer this blog as an aid to current and future AutoHotkey users in their version decisions.

Continue reading

Recognize Running Scripts with System Tray Icon Techniques (AutoHotkey Tip)

If You Run a Number of AutoHotkey Scripts Simultaneously, Distinguish Each Icon in the Windows System Tray with These Menu Commands

At times, I’ve found that I have six or more AutoHotkey scripts running at the same time. Each one adds the little green icon with an embedded “H” to the Windows System Tray. This gets confusing. I can only tell them apart by hovering the mouse cursor over an icon and reading the script name in the Tooltip pop-up message. Sometimes the Tooltip alone doesn’t do an adequate job. Continue reading