With Many If Comparison Commands on the Chopping Block in V2.0, Here’s a Trick for Both AutoHotkey V1.1 and V2.0
While driving with her girls buckled in the back seat of the car, my daughter informed her attentive three-year-old and five-year-old of some important details about the day’s activities. After finishing up her explanation, she asked, “Now, does that make sense?” Both girls responded in unison, “Yes, Mommy!” That seemed to settle things until she overheard the three-year-old while leaning over toward the five-year-old whisper, “That doesn’t make any sense!”
AutoHotkey Version 2.0 Drops the GUI gLabel in Favor of the Object OnEvent() Function
In AutoHotkey V1.1, the primary method for adding action to GUI pop-up windows employs the gLabel inserted into a GUI control’s options. As AutoHotkey moves to object-oriented programming in V2.0, the Gui.OnEvent() function replaces gLabels.
In AutoHotkey V2.0, each GUI control responds to different Gui Events. For example, with the Gui Button control, you can register OnEvent() functions for Click, DoubleClick, Focus, and LoseFocus, while the Edit control directly supports Change. You register each type of initiating action you use with the OnEvent() function. In fact, you must register an event before AutoHotkey will respond. Continue reading →
If You Seek a Wealth of Information about AutoHotkey and How It Works, You Can’t Go Wrong with Jack’s AutoHotkey E-Book Library. See the Benefits! Plus, Coming Soon!—More on the Future AutoHotkey Version 2.0 Release
I currently maintain a number of irons in the fire—all AutoHotkey. With three books in the works (two new and one major rewrite), plus regular blogging about AutoHotkey on this site, I find no shortage of things to do. Right now, you’ll find nine AutoHotkey books available at the ComputorEdge E-Books site on topics ranging from an introductory level Beginner’s Guide to a little more complex AutoHotkey Windows scripting, such as, AutoHotkey Applications and Using Regular Expressions in AutoHotkey. By years end, that number should reach eleven books—hopefully. While continuing with the new books, I’ve shifted part of my focus to updating the older books by adding examples of the new AutoHotkey Version 2.0. I plan to increase the versatility of the library regardless of whether readers ultimately decide to upgrade to V2.0 or stick with the current reliable V1.1. If you own one of the AutoHotkey Library Bundles, then you can get these new rewrites with V2.0 examples absolutely free. Continue reading →
When and If the Time Comes, Regular Expressions (RegEx) Can Help with the Conversion Process from AutoHotkey V1.1 to V2.0
Identified by the (v1,v2) on the right side of the script name in the index, I’ve converted a few of the script on the Free AutoHotkey Script page from AutoHotkey V1.1 to the alpha version of V2.0. At first, I reworked a copy of a script one line at a time. Then I speeded up the process with a couple of Regular Expressions (RegEx) used in conjunction with Ryan’s RegEx Tester. While I continued working one line at a time, I could quickly reformat the entire line at once—mostly. Rather than tediously rewriting a command character by character, the RegEx provides a format which needs very little additional editing.
In AutoHotkey V2.0, GUI Pop-up Windows Turn into Objects, Plus Replacing the Lost V1.1 gLabel
I’ve converted a few of the simpler AutoHotkey scripts on the ComputorEdge Free AutoHotkey Script page (AddDate.ahk, EggTimer.ahk, and LaunchWindow.ahk) from V1.1 to the latest alpha version of V2.0. As I convert and post the new .ahk2 scripts, you can identify them by the (v1,v2) found to the right of the script name in the Download Index.
As We Await the Ultimate Release of AutoHotkey V2.0, Let’s Look at How Things Will Change
As I review the documentation for the alpha version of AutoHotkey V2.0, I can see that 95% of the code in a V1.1 script needs to change to run under the new version. AutoHotkey V2.0 offers a more consistent scripting environment, but you will experience a slight learning curve. Standard Hotstrings offer the only syntax which continues untouched. (Hotkey syntax also stays intact but you will need to update the commands within any Hotkey routines.) That means your AutoCorrect script will likely run fine under both versions of AutoHotkey—unless your Hotstrings execute custom actions.
To get ahead of the curve and give you a chance to make better-informed decisions about ever upgrading to V2.0 (once released), I offer this series of observations comparing V2.0 with V1.1. Digging into V2.0 requires a slightly different way of thinking yet it remains all AutoHotkey. You’ll find the overall script structure and how AutoHotkey processes a file unchanged. Any understanding you already possess about how AutoHotkey works will serve you well. In these blogs, I focus on converting from a language running with commands to one which uses corresponding functions.
Test the Alpha Release of AutoHotkey V2.0 Without Losing All of Your Version 1.1 Apps
In my last blog, I said that you have plenty of time for making your AutoHotkey V2.0 decision. But, that doesn’t mean you can’t play with the current V2.0 version.
Natural curiosity forces many of us to explore the possibilities of the not-quite-ready-for-primetime 2.0 version of AutoHotkey. But, who wants the trouble of uninstalling (and reinstalling) AutoHotkey 1.1 or continually moving around the various versions of V2.0? Fortunately, you can set up both versions of AutoHotkey to coexist without interference. No need to continually move and/or rename of the main AutoHotkey file (AutoHotkey.exe). Using the approach offered here, you can simultaneously run your current V1.1 scripts while playing around with the future V2.0. Continue reading →
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.