AutoHotkey Tip of the Week: Cull Web Links from a Web Page and Activate Each in a Pop-up GUI

This Time I Combine a Number of AutoHotkey Techniques to Put Active Links in a Graphical User Interface (GUI) Pop-up Saving Space with GUI Tabs

As I pondered the GetActiveBrowserURL() function from last time, I looked for more ways to use this unique function by reviewing Chapter Ten, “An App for Extracting Web Links from Web Pages” from A Beginner’s Guide to Using Regular Expressions in AutoHotkey. By combining the function with the UrlDownloadToFile command and a couple of GUI controls (Link and Tab), I quickly wrote a script for collecting all of the external links from a Web page into a pop-up window displaying a list of active links—merely, click to follow one.

WebPageLinks
The GUI contains 10 tabs—most with 20 hot links each scraped from the ComputorEdge Free AutoHotkey Scripts page.

This process included a number of learning points worth discussing:

  1. I found the GetActiveBrowserURL() function more reliable and robust than using the Standard Clipboard Routine.
  2. Depending upon the target Web site, you may need to tailor your Regular Expressions (RegEx) to produce the most useful results.
  3. The GUI Link control creates hot Internet links for immediate action.
  4. The GUI Tab control wraps long lists for scenarios where no scroll bars exist and column wrapping proves impractical.

In this blog, I offer the script with a short discussion of the Regular Expressions (RegEx). In a future blog, I’ll discuss how to build a GUI pop-up window with an unknown number of hot Weblinks (almost 200 in the example at right) while not letting it get out of hand. But first, my thoughts on the GetActiveBrowserURL() function.

Continue reading

AutoHotkey Tip of the Week: Capture Web Page Addresses (URLs)

When Browsing the Web This Special Function Copies the Page URL without Any Extra Effort

Normally, you can find a Web page address in the URL bar at the top of the browser. Click in that address field and copy it with CTRL+C. That simple act may make the subject of this blog look redundant. However, when applied to last week’s CopyRegTagWin.ahk script, the GetActiveBrowserURL() function can save numerous keystrokes.

By using the user-defined GetActiveBrowserURL() function, a modified version of the CopyRefTagWin.ahk script can include both the title of the source window and, if from a Web page, its URL. If collecting data for research, this feature makes reconstructing sources much easier—without any extra effort. Continue reading

AutoHotkey Tip of the Week: Guidelines for AutoHotkey Function Libraries

When Using Function Libraries, You Don’t Need to Embed Your Functions into Each of Your AutoHotkey Scripts—But Sometimes Keeping Them Close Works Out Better

In the past two blogs, “Dynamic Regular Expressions (RegEx) for Math Calculating Hotstrings” and “The Eval() Function for Hotkey Math Calculations and Text Manipulation“, I highlighted two different powerful, auxiliary (not built-in) AutoHotkey functions: RegExHotstrings() and Eval(). Normally, you might embed a user-defined function inside your script but these two functions take up quite a few lines of code. Plus, you might want to use those same functions in a number of different scripts. Adding them to each script can get a little cumbersome—even when using the #Include directive.

Fortunately, when loading a script, if AutoHotkey doesn’t find a directly called function inside the script, it automatically searches the special Function Libraries. But, before you race to put all of your functions in one of those Libraries, you should consider a number of factors. Continue reading