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

Saving Default Data in the Windows Registry (Part Six: Finishing AutoHotkey GUI Scripts)

Many AutoHotkey Users Save Settings in an INI File…However, the Windows Registry May Offer More Security and Stability

We tend to feel nervous about working with the Windows Registry. After all, a wrong step could conceivably cause harm to the operating system setup. Yet when taking the appropriate steps, this built-in Windows database can offer us a number of benefits:

  1. The Windows Registry is always there.
  2. It’s not easy to accidentally delete a Windows Registry entry.
  3. The average computer user won’t know where to find these special data entries.
Continue reading

AutoHotkey Tip of the Week: Quick Menu for Activating Open Windows

With a Few Modifications, the WindowList.ahk Script Pops Up a Menu of Open Windows for Quick Activation—Plus, How to Detect When a Windows Opens or Closes

I originally used the WindowList.ahk script as a demonstration of how to use the GUI DropDownList control as a list of selection options for activating open windows (included in the Digging Deeper Into AutoHotkey book). Once, while testing someone’s script, it proved very useful. I could not find the GUI window generated by the code. The script had placed the target window somewhere off the screen. The scriptwriter originally used a second monitor—which I didn’t have. The WindowList.ahk script moved the window back into my view.

As I reviewed the script, I realized that building a pop-up menu of open windows could serve a purpose similar to the QuickLinks.ahk script—except, rather than launching apps and Web sites, the menu would activate open windows. Now, that’s something that I can use!

I often keep numerous windows open simultaneously. Generally, I locate a window by hovering over the Windows Taskbar then selecting the image which looks right. It takes a second for the thumbnails to appear, then hovering over each helps me make my selection. But what if I could maintain a menu of all open Windows available in a menu for instant activation? Continue reading

When to Rewrite Your AutoHotkey Scripts

AutoHotkey Scripting Philosophy or Speeding Up the InstantHotstring.ahk script

“Before you can fix a problem you must understand it. Before you can understand a problem you must fix it.”

Sounds like a chicken/egg problem, but I assure you it isn’t. You only begin to understand a problem when you start working on a solution. As you grind through a script, you develop a deep awareness of its inner workings. I encourage any AutoHotkey novice to jump into a new script with both feet—even if you don’t think you know what you’re doing.

Sitting around and speculating about possible answers to a question often serves as mental thumb-twiddling. You must start somewhere—anywhere. Until you actually dig into it and undertake the work, you will never truly comprehend the obstacles and pitfalls associated with implementing a fix. You’ll find this singularly true when writing AutoHotkey scripts— especially as a beginner. The answer to the question “Where do I start?” is “Anywhere!” Continue reading

Fixed the InstantHotstring.ahk Script Slow Hotstring Loading Problem

New Version of InstantHotstring.ahk Script Now Available!

I’ve rewritten the LoadHotstrings subroutine in the InstantHotstring.ahk script (alternate download) to overcome the slowdown created by using the pre-existing routines found in the original script, “AutoHotkey Script Speed Problems (Scripting Insights).” I simplified things by limiting the subroutine to:

  1. Adding Hotstrings directly from the file without extra processing—no interaction with the DropDownList GUI control.)
  2. Checking for duplicated or changed Hotstrings within a single variable.
  3. Activating each Hotstring as its added.

AutoHotkey exports the DropDownList GUI control contents just once into a single variable and only writes the new DropDownList after processing the entire target file. The test file of over 1000 Hotstrings loads in one to two seconds—depending upon the weather. (The old routine could take up to 70 seconds for that same file.)

You can find the new code (InstantHotstring(FastLoad).ahk) and the old code (InstantHotstring(SlowLoad).ahk) at the InstantHotstring.ahk section of the ComputorEdge Free AutoHotkey Scripts page.

I’m currently working on blogs which discuss both the philosophical and technical aspect of rewriting the subroutine.

Click the Follow button at the top of the sidebar on the right of this page for e-mail notification of new blogs. (If you’re reading this on a tablet or your phone, then you must scroll all the way to the end of the blog—pass any comments—to find the Follow button.)

jack

This post was proofread by Grammarly
(Any other mistakes are all mine.)

(Full disclosure: If you sign up for a free Grammarly account, I get 20¢. I use the spelling/grammar checking service all the time, but, then again, I write a lot more than most people. I recommend Grammarly because it works and it’s free.)

AutoHotkey Script Speed Problems (Scripting Insights)

When Debugging AutoHotkey Script Speed Problems, Look at Loops First

A number of scripting techniques can cause apps to run slowly. These slowdowns might occur when running long loops, doing extensive searches, or making numerous hard drive reads and writes. But the primary culprit tends to hide within loops or redundant operations of any type. However, you may need to look deeper to find the real source of the problem.

Tip: If you like to keep numerous other programs open, then that alone can cause significant slowing as your computer shares processing time. For example, Google Chrome runs an independent process for each browser tab. Multiple Google Chrome tabs can put a heavy load on the CPU and memory causing delays in any other apps. To optimize time tests, minimize interference by closing all other programs.

Continue reading

Use the FileSelectFile Command to Save Instant Hotstrings to an AutoHotkey File

After Taking the Time to Create Hotstrings with the InstantHotstring.ahk Script, It Only Makes Sense to Save the Code to an AutoHotkey File for Future Use

*          *          *

This blog is part of a series of articles discussing how to create instant Hotstrings using the Hotstring() function.

*          *          *

Ultimately, after writing and activating a number of Hotstrings with the InstantHotstrings.ahk script, we want to save them in an AutoHotkey file. That frees us from recreating the set of auto-replacements the next time we need them. Plus, rather than always loading the Hotstrings into the app, we can run the .ahk file directly with AutoHotkey. Continue reading

Using GUI Checkbox Controls to Set Hotstring Options (AutoHotkey Technique)

AutoHotkey Hotstrings Use a String of Characters to Turn Options On and Off—GUI Checkbox Controls Offer a Visual Display for the Active Options along with a Method for Enabling/Disabling Each Feature

Previously (in “The Coming Instant Hotstring Script (AutoHotkey App)“), we reviewed the work still needed in the InstantHotstring.ahk script. This time we implement Hotstring options using the Hotstring() function.

Converting GUI (Graphical User Interface) Checkbox controls into Hotstring options codes (and back again) involves adept programming tricks. We use GUI windows and their controls to make applications user-friendly. People find it much easier to push discreet buttons and check separate boxes than work directly with often enigmatic programming codes. That means we must build a method for translating between the user-friendly input in a GUI window and the required code. Continue reading

The Coming Instant Hotstring Script (AutoHotkey App)

The InstantHotstrings.ahk Script Allows the Creation and Testing of Hotstrings

Library Benefits

January 5, 2019 Update: You can find the InstantHotstrings.ahk script at the ComputorEdge AutoHotkey Free Scripts page.

I started writing the InstantHotstrings.ahk script as a demonstration of the new Hotstring() function. I planned to keep it basic. (See the previous blogs, “Create Instant Hotstrings Using the AutoHotkey Hotstring() Function” and “Using the AutoHotkey Hotstring() Function to Disable/Enable Hotstrings.”) However, as often happens, the script ballooned into much more. While it continues to demonstrate various aspects of the Hotstring() function, it now includes a number of other features worth discussing (e.g GUI DropDownList, adding Hotstring options, saving and loading files).

I plan to post the current version of the app soon, but I don’t feel it’s quite ready. So, in this blog, I review the script’s features which provide topics for my future blogs. Although not my intention, you could call this a teaser of what’s yet-to-come. I should have the script ready for posting next week. I’ll publish a notice here when I’ve added it to the ComputorEdge Free AutoHotkey Scripts page. (I didn’t want you to think that during this holiday period I wasn’t working on something.)

January 5, 2019 Update: You can find the InstantHotstrings.ahk script at the ComputorEdge AutoHotkey Free Scripts page.

In addition to the two blogs mentioned above, I will write a series of pieces about the meat and potatoes in this new app:

  1. Add Hotstring options to the activated Hotstrings and the GUI DropDownBox control.
  2. Discuss the behavior of the various Hotstring options within the Hotstring() function.
  3. Look at considerations when using the X (execute) option in the InstantHotstring.ahk script.
  4. Save temporary Hotstrings to a .ahk file.
  5. Use the FileSelectFile command to save/load Hotstrings.

Continue reading

Using the AutoHotkey Hotstring() Function to Disable/Enable Hotstrings

While the Hotstring() Function Won’t Delete Hotstrings, It Can Toggle Them Off and On (Disable and Re-Enable)

Technically, once created, you can’t delete a Hotstring without exiting the script. However, you can disable and enable its function. When you disable a Hotstring using the Hotstring() function, it loses its power—similar to the effect of deleting it. But, since the disabled Hotstring still exists, you can bring it back to life by re-enabling it with the same Hotstring() function. Continue reading