The SynonymLookup.ahk Web Data-Driven App Fails (AutoHotkey Adjustments)

If the Source Code for a Web Page Changes, You May Need to Rewrite Your Web Data-Driven Script, Plus More AutoHotkey Tips

Because I do a great deal of writing, I’ve fallen in love with my SynonymLookup.ahk script which pops up a menu of alternative words for instant replacement in my documents. It’s pretty cool—even if I do say so myself. However, the other day, it ceased working.

After highlighting a redundant word, I initiated the Hotkey combination searching for an equivalent term. Nothing happened! No matter how much time passed, the script displayed nothing.

After investigating, I discovered that (exactly as I had contemplated in the first SynonymLookup.ahk blogThesaurus.com had changed the formatting of the target page source code causing my Regular Expression (RegEx) to fail. The manufactured GoTo loop I used to increase the reliability of the Web download created an infinite loop.

I needed to adapt. Continue reading

Checking Your Internet Connection, Plus a Twist on a Secret Windows Feature (AutoHotkey Quick Tips)

If Your AutoHotkey Script Depends Upon Internet Access, Check for an Active Connection Before Continuing, Plus a Surprising Trick for Accessing Hidden Windows Features

Seven Book AutoHotkey AutoHotkey Library Deal!I’ve written a number of scripts which access the Internet for data: IPFind.ahk for locating where in the world an IP address resides; RhymeMenu.ahk for popping up a list of rhymes for any selected word; SynonymLookup for replacing boring words (the impetus for this blog); AutoHotkey Quick Reference, both the now-defunct AutoHotkey reference tool and the new AutoHotkey reference tool currently under development require the Internet; and (not by me) the GooglePhraseFix script posted on the AutoHotkey forum by aaston86; plus, any script which attempts to launch a Web page. All of these apps require an Internet connection to work. Continue reading

Waiting for Web Data to Download (AutoHotkey Quick Tip)

A Look at a Manufactured Looping Technique Using the Goto Command to Ensure the Download of Web Page Source Code in an AutoHotkey Script

EatCheeseBurgerCartoonI 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.

Continue reading

Input Command Creates Temporary Hotstrings from Data Table (AutoHotkey INI File Technique)

By Using an INI Table of Legal Terms, We Construct Instant Hotstrings with the AutoHotkey Input Command

I recently received questions about using AutoHotkey for professional terminology in medical transcription. While features in many word processors such as Microsoft Word allow the building of special auto-correct dictionaries, they only work within Word. Since AutoHotkey works anywhere on a Windows computer, it’s only natural to want your own specialized technical lexicon. However, for the newbie, the question turns into “Where do I start?” Continue reading

Build Your Own Dream Thesaurus Word Replacement Tool (AutoHotkey Web Application)

How to Use the Web to Feed Data to Your AutoHotkey Application—A Pop-up Menu to Replace Boring Words in Your Documents

Synonym Page
I highlight any word and hit the CTRL+L Hotkey combination. AutoHotkey downloads the code from the target Web page and parses the synonyms using RegEx—placing each in a pop-up menu. Click on any item and AutoHotkey replaces the selected word in any document or field open for text editing. In the example, the menu lists possible replacements for the word •PAGE—the first item in the menu. Click •PAGE to open Thesaurus.com at the target location.

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