While in conversations with a reader who uses AutoHotkey to calculate the time span between two dates for figuring out new leases, I realized that a tool which captures formatted dates from any document and converts them into the DateTime Stamp format (yyyymmdd) would make using the HowLongYearsMonthsDays.ahk script even easier. That prompted me to write the DateStampConvert.ahk script. Continue reading →

While AutoHotkey Does Not Include a Conditional Case Statement, You Can Build Your Own Using the Ternary Operator

Many programming languages include Case statements which act in a manner to similar a series of If…Else If…Else statements in an abbreviated form. The simplicity of the structure provides the primary benefit of offering a series of options in semi-list form Continue reading →

AutoHotkey Offers Many Techniques for Converting the DateTime Stamp (yyyymmdd) into Formatted Dates, But What About Going in the Other Direction? Use RegEx to Identify Date Formats!

The HowLongYearsMonthsDays.ahk function calculates the difference in years, months, and days between any two dates. To manually set the two dates, the script employs two DateTime GUI controls—input dates saved in the DateTime Stamp format (i.e. yyyymmdd) and the output in years, months and days. But wouldn’t you find it easier if you could highlight the dates in any document or Web page regardless of format, then use AutoHotkey to convert and copy the DateTime Stamps directly into the DateTime GUI controls? Continue reading →

Save Confusion and Annoying Missteps by Creating Child Dialogs

I began working on the promised formatted date to DateTime Stamp conversion blog when I received this question from a reader:

Hi, Jack,

I’ve created a series of pop-up boxes to help me in doing telephone-service. I have two problems, both with InputBox:

How can I put a comma in the prompt section? I tried things like \, and [,] but none work. I’m sure there must be a solution, but I can’t find it in browsing through your books.

It is possible to include an “always on top” control for the display of an InputBox? It does not seem to work to put ”WinSet, AlwaysOnTop, ON, A” before or after an Inputbox entry. Is there some way to make an Inputbox display automatically stay on top?

Like this:

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.

Originally, 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 →

Jack’s Motley Assortment
of AutoHotkey Tips

A Living Book

This 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.