Switched IPFind.ahk to OpenStreetMap.org for Reliable AutoHotkey GUI Map Embedding

Forget Google Maps for Embedding Simple Maps in an AutoHotkey Graphical User Interface (GUI)—OpenStreetMap Supports iFrame Embedding…and It’s Free!

If you only want a simple reference map for your AutoHotkey GUI, then Google has just made that impossible. Google Maps no longer supports embedding maps in an HTML iFrame. (I wish Google had taken this action before I wrote my last two blogs.) Now, to do anything with Google Maps you must get the API (credit card number required) for even the simplest of things. For many professionals needing the extra features, the API may be worth it. (Google credits $200 each month to low quantity users…at least for now.) But why even bother when OpenStreetMap.org, a public source, offers map embedding free under an open license. Plus, it’s likely to remain free forever.

Last week, I wrote about how to embed a Google map into an AutoHotkey GUI, “Embedding Google Maps in the IPFind.ahk GUI.” Within a day or two, Google blocked all iFrame HTML embedding. (Go figure! I don’t think I’m the only one who might be a little disappointed.) However, that action prompted me to take a closer look at OpenStreetMap.org.

To my delight, I discovered that in my earlier perusal I had overlooked the same type of HTML iFrame embedding that Google once offered (only a week ago)—plus, I found other features that eliminated all of my earlier misgivings about OpenStreetMap.org. Since I had already written the code for adding maps to the IPFind.ahk script using Google, I quickly modified it to use the alternate resource.

While the IPFindGoogleMap.ahk script won’t load any maps, the techniques I introduced in my blogs remain valid. (I plan to leave those blogs intact for future reference.) In this blog, I talk about how to alter the Google Maps IPFind.ahk script to support OpenStreetMap.org.

Continue reading

Use ActiveX Control to Embed World Maps in AutoHotkey GUI

By Directly Loading a Map from OpenStreetMap.org into Your AutoHotkey Graphical User Interface (GUI) Pop-up Window, You Can Add Interactive Geographic Locations to All Your Apps

I have some good news and some bad news about using AutoHotkey tools to directly access Web data through the Internet. First the bad news. Since the AutoHotkey tools for downloading and reading Web pages use Internet Explore (built into Windows but no longer supported by Microsoft), Web providers can effectively block access by identifying that user browser. For the good news, you rarely need to use those sites blocking simple little personal apps such as my IPFind.ahk script. So many other sites support location data for IP addresses that I don’t have a problem keeping the script up and running.

For a quick glance at the geographic location of an IP address, insert an OpenStreetMap.org Web window into an AutoHotkey GUI. Hold the mouse cursor over a map and scroll in or out to zoom in or out.

Previously, I had repaired other issues caused by changes in the source Web page and converted the IPFind.ahk script to use a GUI window rather than a MsgBox command. This upgrade facilitated adding links to the app, see “Adding Web Links to the AutoHotkey IPFind.ahk Script,” as well as making the current insertion of interactive maps using the ActiveX GUI control possible. I fixed the IPFind.ahk script problems by switching to another source Web page and added an interactive map from OpenStreetMap.com.

Continue reading

Adding Web Links to the AutoHotkey IPFind.ahk Script

While Fixing the IPFind.ahk Script for Listing the Geographic Location of an IP Address, I Added Links for the IP Identification Site and OpenStreetMap

Occasionally, Web page scraping apps fail (or display strange results) due to changes in source page data formats. It usually only takes a few minutes to review the code and make the necessary RegEx adjustments to restore acceptable results. This time while repairing the IPFind.ahk script, I noticed that the Web page source code also offered IP longitude and latitude. I thought, “Why not add a map link to the display window for anyone curious about its geographic position?” The IP site (which I also added as a link) includes a map, but I wanted one with greater detail.

An IP address site can provide a great deal of information—including approximate longitude and latitude.

Note: I recently discussed the Link GUI control in “Turn Web Addresses into Hotlinks for the AHK File Peek Window.”

Continue reading

Turn Web Addresses into Hotlinks for the AHK File Peek Window (AutoHotkey Tip)

Using the AutoHotkey GUI Link Control to Display AHK File Notes Allows You to Turn Web Links Hot

While perusing the notes in various .ahk scripts using the subroutine ReadNotes—which I had added to the AutoStartupControl.ahk script and discussed in my blog “Peeking at Notes Inside Auto-Startup AHK Script Files (AutoHotkey Startup Control)“—I noticed that many scripts included URLs to reference sites. A common practice used by scriptwriters when giving credit to another script or offering additional information about the source, these sites can offer valuable insight or resources. Usually, a Web address appears as a complete URL including the HTTP(S)://. I wondered, “Wouldn’t it be great to just click a link in the Notes window to load the page?”

Since we write AutoHotkey scripts in plain text, attempting to provide hotlinks inside the file using HTML code (or other techniques) doesn’t make much sense. I can open the file and copy the Web address—pasting it into my browser, but a hotlink in the Notes window would save a lot of time. I immediately switched from using the Text GUI control to the Link GUI control. By inserting the Link control into the AutoStartupControl Notes GUI window, I can turn any URL into a hotlink—as long as I use a Regular Expressions (RegEx).

The Link GUI control in the Notes window can turn any fully formed Web address into a hotlink for immediate access.

Using the Link GUI control comes with a couple of foibles, but, for the most part, it behaves in a manner very similar to the Text GUI control.

Continue reading

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