Google Maps from Selection

with AutoHotkey

by Denis Lamarre
last updated March 10, 2019
difficulty.png easy

Description

How are you using Google Maps? Do you have to select an address, copy it to the clipboard, start Google Maps, paste the address, and finally hit Enter to get the location? If you are doing this again and again, you may find the following AutoHotkey script useful. Simply select the address and then press the keyboard hotkey. This will bring the address up in Google Maps.

Steps

1

overlay-um-googlemaps.gifPrepare your overlay
Choose an unassigned key on the Enterpad for your Google Maps function. Name it something appropriate, like "Google MAPS".

2

Code installation
Copy and paste the following script in the AutoHotkey script template (Enterpad.ahk) at the location of the key you wish to assign.

001:
  ClipSaved := ClipboardAll
  Clipboard =
  SendInput, ^c
  ClipWait, 2
  if ErrorLevel 
  {
      MsgBox % "Failed attempt to copy text to clipboard."
      return 
  }
  NewClipboard := Trim(Clipboard)
  StringReplace,NewClipboard,NewClipboard,`n,%A_SPACE%,A
  StringReplace,NewClipboard,NewClipboard,`r,,A
  Clipboard := ClipSaved
  ClipSaved =
  run https://www.google.com/maps/search/%NewClipboard%/
  NewClipboard := 
return

More Info

The address you select can be on several lines. Line breaks will be replaced with spaces.

Google.com (USA) is used at line 16. You can use your country's Google instead (e.g., google.ca, google.au).