A while back I wrote a series of articles on using AutoHotkey for Windows program automation. They appeared in the old ComputorEdge Magazine. I used Windows 10 Paint as the example program demonstrating a number of approaches to program control. I temporarily put the articles in a makeshift PDF for artists and intend to include them in a future book—along with a couple of other unpublished Windows program automation articles. I extracted some of those columns from the original ComputorEdge issues and combined them into one free PDF download: AutoHotkey for Artist.pdf. The links may be obsolete, but the info is still good!
How to View the Inner Workings and Hidden Mechanisms of Running AutoHotkey Scripts
AutoHotkey includes a tool called the Main Window which aids with the debugging process. It gives you a peek into various aspects of a running .ahk script:
- Most recently executed lines of code (ListLines command).
- Current variables and values (ListVars command).
- Active Hotkeys (ListHotkeys command).
- Keyboard activity (KeyHistory command).
Open the Main Window by right-clicking on Windows System Tray icon of an active .ahk script and selecting Open from the top of the menu. The window pops open at the “Lines most recently executed” view. You can select the other three views plus “Refresh” from the View menu. Continue reading
New E-Book Bundles for Making Your Journey into AutoHotkey Scripting Easier
Every programmer suffers moments where he or she achieves a breakthrough and the code actually works. Their first impulse—tell someone…anyone. “Look what I just did!” Alas, they find no one nearby to praise the accomplishment. At least, no one who either understands or cares about their success. Maybe that’s why I write about my AutoHotkey journeys. I need to tell someone when (ironically?) some code I wrote does what it’s supposed to do. Continue reading
Exploring the Existential Mysteries of AutoHotkey Code and How It’s Often Misunderstood
I’ve just published my latest book, Beginning Tips for Writing AutoHotkey Script, which endeavors to clear up some of the mystery surrounding the way AutoHotkey works. You’ll find grasping how AutoHotkey processes AHK scripts a tremendous help. Quite a bit of the confusion encountered by novice AutoHotkey scriptwriters occurs through misunderstandings about the manner in which everything (life, the universe, and AutoHotkey scripts) fits together. I wrote the book with that muddiness in mind. Continue reading
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
Rather than Manually Creating Windows Shortcuts for QuickLinks.ahk, Use the AutoHotkey FileCreateShortcut Command
* * *
Recently, while working with the QuickLinks.ahk script, I’ve encountered so many AutoHotkey learning points involving a number of different techniques that I plan to spend the next few blogs discussing the various possibilities. If you regularly use QuickLinks, then you’ll likely want to fashion it to your needs. While most of the tailoring gets done by working directly with the target folders, you’ll find times when changing the code works best. Rather than attempting to deliver a final product for final download, I offer instruction on how to add various features to your version of QuickLinks.ahk and leave the work up to you. The example shown in the image below reflects the changes I’ve made to my personal copy and do not appear in the posted version.
* * *
One of the characteristics I like most about the QuickLinks.ahk script is its simplicity. It operates on a basic backbone which includes two loops (the files and folders Loop command). The first loop works through the folders found in the QuickLinks directory creating the top level menu. The second loop adds the individual links in each folder to each main menu item. Continue reading
Dynamically Switch the Actions of a Running AutoHotkey Script with a Simple Click of a System Tray Right-Click Menu Item
From Rick Corbett:
Talking of “Adding Actions to Windows System Tray Icon Menu“, perhaps you would consider writing about using—for example—ToggleCheck, MenuItemName to amend a running script dynamically, i.e. change something (like toggling logging to a file versus a MsgBox), then reload.
* * *
That’s an excellent question, Rick! Often, after loading a script, we want to either turn features off and on or change how they function. Adding separate Hotkeys or rewriting scripts becomes wearisome. But, what if we could add a feature to the Windows System Tray Icon Context Menu (right-click) which either toggles an action on and off or completely changes how it works? AutoHotkey offers a straightforward way to get it done. Continue reading