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

Loading Hotstrings into the InstantHotstring.ahk Script from Any AutoHotkey (.ahk) File

Reading Data from a Saved .AHK Files Makes Loading Hotstrings into the InstantHotstring.ahk Script Easy

In the blog, “Use the FileSelectFile Command to Save Instant Hotstrings to an AutoHotkey File.” I discussed how to save a set of newly created InstantHotstring.ahk Hotstrings in .ahk files. The other half of the file storage problem involves reading those saved (or any other) Hotstring data files back into that same app. Using the tools already built into the script made writing the file loading code remarkably easy. The subroutine LoadHotstrings calls on the previously written subroutines SetOptions and AddHotstring. This saves replicating of code originally used in those subroutines.

Continue reading

Limit the Number of Substrings Delivered by the StrSplit() Function (AutoHotkey Quick Tip)

A New Parameter in the AutoHotkey StrSplit() Function Makes Selective Parsing Possible

robotparse.pngAt the same time as when we saw the release of the new Hotstring() function and other added Hotstring features (AutoHotkey version 1.1.28.00 – February 11, 2018), the powers-that-be made a significant change to the StrSplit() function. I don’t know if the idea grew from the need to parse Hotstrings or just happened to coincide with that release of AutoHotkey.

I discovered the new power when I ran into trouble working with the InstantHotstring.ahk script while using a Web address as replacement text. This useful new StrSplit() parameter (MaxParts) might save you from adding more code when you need to limit the number of produced pieces of text. (Don’t believe it when they say, “Parts is parts!”)

Continue reading