Jack’s AutoHotkey Blog

The Best Type of Brain Food!
Get Started with AutoHotkey with this
Introduction to AutoHotkey
A Review and Guide for Beginners

See Also, New Book of Jack’s Motley Assortment of AutoHotkey Tips

*          *          *

November 8, 2018

DateConvertSend

I conclude with the DateStampConvert.ahk script—at least, for now.

Library Benefits

November 2, 2018

Use the Ternary operator to simulate Case statements.

October 30, 2018

Now, I offer a script to convert dates found in documents into the DateTime Stamp format required by most AutoHotkey date functions and commands.

October 19, 2018

I’ve added two new chapter to the “Second Edition of the New Beginner’s Guide” discussing how to use AutoHotkey to automate your PC software.

October 16, 2018

Solved the problem caused by an open MsgBox window: “Use Gui, +OwnDialogs to Glue Modal Dialogs Boxes to GUI Parent Windows (AutoHotkey Best Practice)

October 11, 2018

Useful when you need it, “Swapping Variable Values (Beginning AutoHotkey Tip).”

October 8, 2018

I just published my latest book Jack’s Motley Assortment of AutoHotkey Tips. It’s a big one with over 80 chapters of miscellaneous tricks and techniques. Click the links below to review the “Table of Contents” and “Index“, plus learn how AutoHotkey Library Members can get a discount. Continue reading

Advertisements

Wrapping Up the DateStampConvert.ahk Script (AutoHotkey Tips)

In Previous Blogs, I Used Regular Expressions to ID Dates Formats in Documents and Simulated Case/Switch Statements to Convert Month Names to Numbers. Now, I Build the Standard DateTime Stamp, Check for Valid Dates, and Deal with Two-digit Years, Plus Use the Function ByRef Method to Bypass Local Variables.

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

Use the Ternary Operator to Create Conditional Case Statements or Switches (AutoHotkey Tip)

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

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