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

Swapping Dyslexic Letters (A Favorite AutoHotkey Trick)

Sometimes the Little Things Remind Me How Much I Like AutoHotkey

As I worked on one of my blogs, I accidentally transposed two letters (probably “form” for “from” or vice versa). I placed the cursor between the errant letters and hit the R key while holding down ALT. The two characters exchanged position. Pleased with myself, I decided to highlight the letter-swapping Hotkey combination in this blog as one of my favorites.

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 AutoHotkey.com 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