A Look at a Manufactured Looping Technique Using the Goto Command to Ensure the Download of Web Page Source Code in an AutoHotkey Script
I ran into a problem with the SynonymLookup.ahk script. On occasion, the menu would appear showing only the original bold and bulleted search term as its sole menu item. This occurred when the script finished processing before downloading the source code from the Thesaurus.com page. As often happens when working on the Internet, the Web connection took a little too long to perform its job.
A common headache with any AutoHotkey script which uses the Web, the time it takes to interact with a site and download its content profoundly fluctuates. In the case of the SynonymLookup.ahk script, I needed to ensure that the variable containing the Web page source code existed and contained text before continuing to parse the synonyms.
How to Use the Web to Feed Data to Your AutoHotkey Application—A Pop-up Menu to Replace Boring Words in Your Documents
I immediately added this short AutoHotkey script to my primary toolbox. It immediately provides me access to a list of alternative words in menu form (shown at right). Click on one of the entries and it instantly replaces the previously highlighted word. The apps beauty lies in the fact that I can utilize the Web for the database of synonyms. The script extracts the menu items directly from a Theraurus.com Web page without opening my Web browser or processing any of the code—no ads. For writers and editors (or anyone who wants to expand their vocabulary), this one script provides enough incentive to plunge into regularly employing the free AutoHotkey Windows utility language.
If Theraurus.com ever notices, I suppose this script may not make the owners of the site very happy. Any revenue they derive comes from the advertising. My app ignores all of it. They could change the formatting of the page, but then I would adjust the Regular Expression I use to extract the data. They might make an attempt to block my efforts, but I guess any such blocking technique would also block regular users. They could block my IP, but that would be a lot of work for just one person. (I would simply switch to another site offering synonyms.) In any case, I plan to continue using this AutoHotkey script until it stops working—for whatever reason. Then, I’ll fix it. Continue reading →
Use Simple Database Files to Both Write AutoHotkey Code and Create Flexible Scripts
In the last blog, I introduced a simple AutoHotkey app I call PictureSounds.ahk. When the user clicks on an image, AutoHotkey seeks the name of the sound file in an INI lookup table, then plays it. The script uses the image file name as the INI file Key. After loading a series of images, the script plays a different sound for each image. (It even plays videos!)
Using the INI file as a lookup table saved me from writing a different subroutine (or at least If condition) for each Picture control in the GUI window. Now, I show how to use that same data file to write the command code lines for adding the images to the pop-up files. Continue reading →
With Many If Comparison Commands on the Chopping Block in V2.0, Here’s a Trick for Both AutoHotkey V1.1 and V2.0
While driving with her girls buckled in the back seat of the car, my daughter informed her attentive three-year-old and five-year-old of some important details about the day’s activities. After finishing up her explanation, she asked, “Now, does that make sense?” Both girls responded in unison, “Yes, Mommy!” That seemed to settle things until she overheard the three-year-old while leaning over toward the five-year-old whisper, “That doesn’t make any sense!”
The Standard AutoHotkey Loop Command Works Great for Incremental Series, But the For Key [, Value] in Expression Object Loop Offers Unique Flexibility for Associative Arrays
In my last blog, I introduced associative arrays to the InstantHotkeyArrays.ahk script for solving the connection problem between the Instant Hotkey combination and the insertion text. It works brilliantly—although novice AutoHotkey users might experience a slight learning curve.
On the downside of associative arrays, the standard AutoHotkey Loop command may not provide the access you need to all of the array items. Fortunately, AutoHotkey provides a command specifically for use with Objects such as true arrays: For Key [, Value] in Expression.