Finalizing an AutoHotkey Script

While No One Actually Ever Completes an AutoHotkey Script, Some People Get Much Closer Than Others

Last June I started a series of blogs on “Finishing and Polishing AutoHotkey Scripts.” (Ironically, I never finished either the script or the series of blogs.) I wrote six articles aimed at making a script more flexible and user-friendly. Once I had added a menu bar to the GUI window, my chosen menu items provided a map to the ultimate finished product. In the course of that work, I introduced a number of methods for enhancing the program.

Continue reading

Create Instant Windows Gadgets Using AutoHotkey Graphical User Pop-ups (GUIs)

One of the Easiest and Quickest Means for Building a Short, Useful PC App Takes Advantage of AutoHotkey GUI Controls—A Review for the Novice Scriptwriter

Many of my sample scripts available at the Free ComputorEdge AutoHotkey Scripts page use the built-in Graphical User Interface (GUI) tools available in the Windows operating system. Taking advantage of these Windows mechanisms demonstrate only one of the many reasons why the free AutoHotkey scripting language affords so much power. With a few lines of code, you can build Windows gizmos for an innumerable variety of applications. The GUI pop-up acts as the primary core for many AutoHotkey scripts. Easy-to-use and only requiring a minimum amount of programming, the GUI makes possible Windows gadgets for almost any use.

While almost all of my books discuss how to use GUIs in a number of different ways, the book AutoHotkey Applications: Ideas and Tips for Writing Practical AutoHotkey Scripts spends a great deal of time discussing various AutoHotkey Graphical User Interface (GUI) pop-ups with example scripts.

Continue reading

Use Alternative Filename Extensions for Special Format Files (Part Five: Finishing AutoHotkey GUI Scripts)

While Changing the Saved Filename Extension in the InstantHotstring.ahk Script Helps Protect Original AutoHotkey Files, the Technique Offers Additional Benefits…Plus, a No-Wait Progress Bar for Instant-Saves

Over the course of the past few blogs, I added protection to files containing AutoHotkey code by both including a one-line file header and changing the saved filename extension to .hsf. These steps have resolved my concern about overwriting any AutoHotkey scripts—from which I may have extracted Hotstrings and loaded them into the “under-construction” InstantHotstringMenuBar.ahk app. At times, I thought that adding the two techniques might be overkill but now I’ve come to realize that using an alternative extension provides benefits that may prove even more useful than my initial attempt at protecting .ahk files.

Continue reading

Use the GoTo Command to Traverse Long Subroutines (Part Four: Finishing AutoHotkey GUI Scripts)

Sometimes the GoTo Command Makes Life Easier without Creating Perverse Effects

This next portion of the InstantHotstring.ahk menubar implementation did not go as I had expected. I thought that I would break up the routine launched by the Save Hotstrings button into separate subroutines or functions, then call each as appropriate for the corresponding Save/Append Hotstrings menu items (as seen in the image). I didn’t look forward to it because I knew it could get a little confusing. Some items would require multiple subroutine calls while others would need to just run—depending upon the menu selections made by the user.

I didn’t want to write redundant subroutines, but separating the various features of the complete routine required more than merely adding Return commands to encapsulate the code. I finally ask myself, “Why not insert AutoHotkey Labels into the main Save routine and use the GoTo command to jump my way through the decision points?”

Continue reading

Sensing AutoHotkey Editing Changes for Instant Save (Part Three: Finishing AutoHotkey GUI Scripts)

By Detecting Modifications in Edit Data We Know When to Activate Instant-Save Routines

Any change too active Hotstrings appends an asterisk (*) to the current open filename and enables the Save option.

In the last blog (“GUI Menu Bar “Save” Item Complications (Part Two: Finishing AutoHotkey GUI Scripts)“), I discussed the need to add a special header to a unique type of data file—InstantHotstring generated Hotstrings. This header helps to differentiate between AutoHotkey .ahk files—which you may not want to overwrite—and files generated by the InstantHotstring.ahk script.

When adding a Save option (instant-save using the CTRL+S key combination) to the menu bar, many Windows apps concatenate an asterisk (*) to the file name in the title bar—alerting the user to changes. In this blog, I add a similar change-detecting feature which both displays the appended asterisk and enables an instant-save routine.

Continue reading

GUI Menu Bar “Save” Item Complications (Part Two: Finishing AutoHotkey GUI Scripts)

Most Menu Bars Include Both “Save” and “Save as…” Options in the File Menu—Each Requires Special Considerations

As I mentioned last time, the act of adding a menu bar to a GUI can force the rethinking of many routines in the script. This time the consideration of the Save option(s) compelled me to reconcile potential problems when attempting to run the Save routine in the expected manner. First, knowing the actions activated by the Save Hotstrings button in the InstantHotstring.ahk script provides an understanding of the items required in the GUI menu bar.

Continue reading

Radically Improving AutoHotkey GUI Apps with Menu Bars

While GUI Menu Bars Make Your AutoHotkey Apps More User-Friendly, the Benefits from Adding One to Your Script Go Far Beyond the Obvious

* * *

This blog represents the first in a series that revisits the InstantHotstring.ahk script introduced and developed in previous posts—starting with “Create Instant Hotstrings Using the AutoHotkey Hotstring() Function.” In this new endeavor, I add a GUI menu bar which significantly alters my view of the app. The benefits of implementing a GUI menu bar greatly exceed its functional use.

* * *

I consider most of my scripts demonstrations of how to implement AutoHotkey possibilities—not completed applications. I rarely go back to do all the little things that will make a script a finished product—in two senses of the word: virtually completed and fine-tuned. Many of my favorites (QuickLinks.ahk, MousePrecise.ahk, SynonymLookup.ahk, AutoCorrect.ahk, ChangeVolume.ahk, etc.) don’t require much additional work—if any—although, a script rarely achieves perfection. Most of my scripts use menus, Hotkeys, or Hotstrings while running in the background—not requiring extra visual bells and whistles. However, once you base an AutoHotkey script on a GUI (Graphical User Interface) pop-up window, the need for additional finishing touches increases—especially if it opens and saves files.

One of the best methods for finishing an AutoHotkey GUI app involves adding a menu bar. (You might also argue that the writing of a GUI script should start with a menu bar. It creates a road map to the finished product.) On the surface, a GUI menu bar makes the app more user friendly, but, more importantly, the process forces you to rethink the design and structure of your script.

Continue reading

AutoHotkey Tip of the Week: WinMenuSelectItem for Windows Automation

While It Works Only for Classic Style Windows Menubars, the WinMenuSelectItem Command Makes Changing App Settings Easy

CoverImage200
A Multitude of AutoHotkey Tips and Tricks

In Chapter 8.1.7 “Control Windows Program with the WinMenuSelectItem Command…Maybe” of the book Jack’s Motley Assortment of AutoHotkey Tips, I discussed the use of the WinMenuSelectItem command for Windows automation. While it has its limitations (it doesn’t operate with programs using ribbon-style menus), its power makes possible simple setup changes in apps such as Notepad, Notepad++, IrfanView image viewer/editor, and, most importantly, AutoHotkey GUI (Graphical User Interface) pop-up apps with menubars—such as one of my favorites,  CodeQuickTester by GeekDude. If you work with one of the compatible programs, then the command offers a number of advantages. Continue reading

AutoHotkey Tip of the Week: Use the GUI Menu Bar for Instant Hotkeys

Rather than Creating New Hotkeys and Isolating Them Using the #IfWinActive Directive, Simply Add Keyboard Accelerators Using a GUI Menu Bar

Note: This week’s keyboard accelerator tip is not the same technique as adding an ampersand before any letter in a menu item—although that trick still works. The beauty of this technique lies in the fact that you can embed and execute a multitude of active window Hotkey-like actions in a menu bar without ever opening the menu itself.

In almost every one of my books, I discuss using the Menu command to build free-floating selection lists for a wide variety of tasks. I use menus for the HotstringMenu.ahk script, the QuickLinks.ahk favorites app, SynomynLookup.ahk, and numerous other purposes. In the GUI ListView control examples found in the AutoHotkey Applications book for the to-do list, the address book, the calorie counting app and listings of icon images, the right-click context menu pops open for individual action items. Menus provide an easy method for adding features to AutoHotkey scripts while saving space. I’ve always known that you can add a menu bar to the top of any AutoHotkey GUI (Graphical User Interface) but had little to say about it—until now.

ToDoListINI
The Ctrl+T in the menu bar item creates an accelerator key combination which, whenever pressed, acts as an active window Hotkey for instantly executing the option—even without opening the GUI menu bar.

While working on my latest to-do list script (ToDoListINI.ahk), I realized that I wanted to add a couple more options to the app, but I didn’t like the idea of inserting more buttons into the GUI. I naturally turned to a menu bar at the top of the GUI which could include many more actions while taking up minimal area. After a quick glance at the Gui, Menu command, I realized that I had routinely overlooked one of the most important aspects of Gui menu bars: accelerator keyboard combinations. Continue reading