Two-Deep Variables for Tracking Data (AutoHotkey Trick)

When You Find No Obvious Way to Link Specific Data to an Object or Another Value, You Might Try Saving It to a Variable within a Variable

Sometimes you encounter a scripting situation where saving data to just any random variable doesn’t do the job. While creating variables and storing values is simple enough, you may find it difficult to recall those values at the right time. It’s important to know you’re getting the right data when you want it. Maybe using the value of a variable as a variable name (two-deep) will give you what you need. Continue reading


Create Multiple GUI Pop-Ups in a Single Script (AutoHotkey Scripting)

This AutoHotkey GUI (Graphical User Interface) Trick Builds New GUIs (Graphical User Interfaces) On-the-Fly and in the Same Script without Conflicts

I originally wrote the InstantHotkey.ahk script as a practical demonstration of how to use the Hotkey GUI control. The script’s major downside involves the need to run a new instance of the app for each new Hotkey combination/insertion text pair. Adding the #SingleInstance Off directive solved the problem of loading the same script multiple times, but the System Tray clogged with icons after initiating a number of Instant Hotkeys simultaneously. (I couldn’t just eliminate the System Tray icons (#NoTrayIcon or Menu, Tray, NoIcon) because I could quickly lose track of the various Hotkeys. Plus, eliminating tray icons presents other dangers.)

I combined the script with my master AutoHotkey script by including a Hotkey and the Run command (^!h::Run, InstantHotkey.exe). This avoided the problem of multiple conflicting GUIs in the same script—although it did nothing about the System Tray icon overload.

My recent work inspired me to solve the problem by uniquely naming the GUIs. In the course of writing the new script, I added a number of other useful techniques which I plan to cover in future blogs. Stayed tuned! You might find a few of them quite helpful. Continue reading

How to Write Easy-Merge AutoHotkey Scripts (Technique Example)

These Steps Make Integrating Your Script Into Combo Apps Simple

In my last blog, “Encapsulate AutoHotkey Code for Multi-Script Integration and Portability (Scripting Techniques)“, I explained how to hermetically seal the auto-execute section of a script, then make variable and code object names unique—thereby reducing the risk of conflict within other scripts when building combo apps. By doing this, the script turns into a robust entity easily added to any other .ahk script while continuing to stand on its own as an independent app. As the example for this blog, I’ve rewritten the ScreenDimmer.ahk script. ScreenDimmer(I explain in detail how ScreenDimmer.ahk works in the e-book AutoHotkey Applications—which offers numerous AutoHotkey tips and tricks while reviewing all of the available AutoHotkey GUI (Graphical User Interface) pop-up controls with practical demonstrations of how to use each.) Continue reading

How AutoHotkey Reads Scripts (AutoHotkey Script Structure)

Understanding the Layout of an AutoHotkey Script Helps When Writing and Debugging Applications

The Problem with AutoHotkey Script Design

If you’re anything like me, then you probably jump straight into writing a script without reading the online documentation. Experienced programmers don’t have much problem with this, although even they occasionally find themselves scratching their heads about a particular piece of code which seemingly gets ignored by AutoHotkey. Continue reading

For Speed, Replace the Send Command with Control, EditPaste (AutoHotkey Tip)

The Control, EditPaste Command Adds Great Speed to Standard Text Insertion Routines—within Certain Limits

My work in the last blog on “Why AutoHotkey for Students?” hatched a couple of personal AutoHotkey epiphanies. After all these years of using and writing about AutoHotkey, I continue to readthemanualsurprise myself with new discoveries. If I had read every word of the documentation (and possessed the ability to remember it all), then I may have understood these insights long ago. However, the AutoHotkey documentation contains a wealth of information which takes a great deal of time to digest.

I can’t fault the online manual because it covers nearly everything. Yet, it doesn’t always point out which bits are the most useful. When I discover a command or technique which significantly improves the operation of a script, I call it a “Best Practice.” Otherwise, I tend to keep using the same old techniques until something causes me to dig a little deeper. Last week presented just such an opportunity.

The biggest problem introduced by discovering these little gems involves going back and testing their limitations, then replacing all my old code lines with the better technique. Continue reading

The WinSet, ExStyle Command for Mouse-Click Transparent Windows (Intermediate AutoHotkey Tip)

After Always-On-Top and Translucent Windows, Use the WinSet Command to Make a Mouse-Click Transparent Help Window, Plus a Discussion of the Mysterious (and Confusing) Microsoft Window Styles/ExStyles (WS_XXX and WS_EX_XXX)

Continue reading