Using Regular Expressions to Convert Most Formatted Dates into DateTime Stamps (AutoHotkey Tool)

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!

DateStampThe 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

Second Edition of the New Beginner’s Guide Includes More Windows Program Automation

Two New AutoHotkey PC Software Automation Chapters in the Second Edition of Jack’s New Beginner’s Guide to AutoHotkey

AHKNewCover200In the course of editing Jack’s Motley Assortment of AutoHotkey Tips, I discovered two chapters discussing Windows program automation which long ago I had intended to add to the AutoHotkey Beginner’s Guide. My bad. I have now fixed that omission and added them to the Second Edition. The new chapters appear as follows:

Chapter Seventeen: Automate Any Program in Windows, Part I (New in Second Edition)

  • Use AutoHotkey to Automate Your Favorite Windows Programs
  • AutoHotkey Works with Any Program
  • Automating Program Menus
  • Using Menu Shortcut Keys
  • Cascading Menus
  • Navigating Pop-up Windows
  • Click to Success!
  • Finding AutoHotkey Key Names

Chapter Eighteen: Automate Any Program in Windows: Part II (New in Second Edition)

  • Find the Hidden Names of Program Controls to Automate Windows Applications
  • Using Control Names to Automate Programs
  • Finding Control Names
  • Control Commands
  • Less Code with ControlSetText Command
  • Save As… Dialogue

Continue reading

Use Gui, +OwnDialogs to Glue Modal Dialogs Boxes to GUI Parent Windows (AutoHotkey Best Practice)

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:

  1. 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.
  2. 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?

Many thanks,

Tim

Continue reading

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