Use BoundFunc Object [Func.Bind()] to Pass GUI Control Data (An AutoHotkey GUI Revelation)

Added as a Special Feature to AutoHotkey V1.1, You Can Quickly Bind Unique Data to GUI Controls for Passing to Functions—It’s Even Easier in V2.0. Add This One to Your Bag of AutoHotkey Tricks!

Sometimes in my explorations, I come across an unexpected gem. I dig into many aspects AutoHotkey merely because they exist—having no idea how a technique might affect my scriptwriting. Whenever I uncover a feature that switches on a light, I must admit I get a little excited. Interestingly, if I had not been rummaging through AutoHotkey V2.0, I may not have ever understood the significances of this latest revelation for GUI pop-up windows in V1.1 scripts.

*          *          *

GraphicSoundsIn a GUI (Graphical User Interface) pop-up window, passing the right data to a gLabel subroutine (or function) from a GUI control can get complicated. A couple of the more common methods includes calling the Gui, Submit command to store control values or using a technique for capturing control information, such as the MouseGetPos command or the special gLabel alternative function:

 CtrlEvent(CtrlHwnd, GuiEvent, EventInfo, ErrLevel:="")

While I can usually find a way to solve the data passing problem, I often find the answer awkward. Continue reading


Write Less Code with Database Driven Apps (AutoHotkey Script Design)

Use Simple Database Files to Both Write AutoHotkey Code and Create Flexible Scripts

GraphicSoundsIn the last blog, I introduced a simple AutoHotkey app I call PictureSounds.ahk. When the user clicks on an image, AutoHotkey seeks the name of the sound file in an INI lookup table, then plays it. The script uses the image file name as the INI file Key. After loading a series of images, the script plays a different sound for each image. (It even plays videos!)

Using the INI file as a lookup table saved me from writing a different subroutine (or at least If condition) for each Picture control in the GUI window. Now, I show how to use that same data file to write the command code lines for adding the images to the pop-up files. Continue reading

Building a Lookup Table with an INI File (AutoHotkey Reference Tip)

In AutoHotkey, You Can Use an INI File as a Database for Relating Lookup Table Items

Admittedly, AutoHotkey lacks sophisticated database tools for storing, sorting, and reporting sets of information. While you can piece together commands to create pretty good database file systems, AutoHotkey does not hold a candle to specialized data handling software packages which use SQL and other high-powered relational tools. However, AutoHotkey does support a simple form of a database called an INI file with built-in commands which make it easy to read and write data. These features give us a method for building a lookup table to relate our AutoHotkey Version 1.1 commands to 2.0 functions references. 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 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

Preparing for AutoHotkey Version 2.0 (Even If You Don’t Need It)

Many AutoHotkey V1.1 Commands Offer Parallel Functions Which Run in Both V1.1 and V2.0—It Makes Sense to Use Them Now

I recently noticed an evolution in the online AutoHotkey documentation. Over the past number of years, the powers-that-be have added new functions which serve the same purpose as the traditional command. Yet, they have made no particular effort to highlight the significance of those functions. That has changed. Continue reading

A Quick Tip for Matching Something Inside a Variable (AutoHotkey Tip)

With Many If Comparison Commands on the Chopping Block in V2.0, Here’s a Trick for Both AutoHotkey V1.1 and  V2.0

RobotMakeSenseWhile 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!”

Continue reading