Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keyboard Shortcut - Get Geolocation Data of a Selected IP address
#1
Lightbulb 
This following script will help you quickly bring up geolocation data for a selected IP address. The script works by copying selected content to the clipboard, which, if it looks like an IPv4 address (e.g. 255.255.255.255), will start “iplocation.net” with your default browser. The IP address is automatically entered as a query. This will give you the geolocation data for the IP address.

Need help creating a keyboard shortcut with ShortKeeper using the following AutoHotkey code? This 5-minute tutorial will help!
ClipSaved := ClipboardAll
Clipboard =
SendInput, ^c
ClipWait, 2
if ErrorLevel
{
  MsgBox % "Failed attempt to copy text to clipboard."
}
else
{
  IpAddress := Trim(Clipboard)
  FoundPos := RegExMatch(IPAddress, "^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$")
  if (FoundPos)
    Run % "https://www.iplocation.net/?query=" . IpAddress
  else
    MsgBox % "Invalid IPv4 address selected!"
}
Clipboard := ClipSaved

The script will restore the previous clipboard content.

Spaces and tabs at the beginning and end of the selection will be omitted from the selection.

An error message will be displayed (line #7) if nothing is selected. The IP address verification occurs at line #12.

If you would like to launch the geolocation website (iplocation.net) with a non-default web browser, replace line #14 with one of the following:

For Chrome
Run % "chrome.exe " . "https://www.iplocation.net/?query=" . IpAddress

For Edge
Run % "microsoft-edge:https://www.iplocation.net/?query=" . IpAddress

For Firefox
Run % "firefox.exe " . "https://www.iplocation.net/?query=" . IpAddress

For Internet Explorer
Run % "iexplore.exe " . "https://www.iplocation.net/?query=" . IpAddress
Enterpad: For those who need more than a few shortcuts.

Reply


Messages In This Thread
Keyboard Shortcut - Get Geolocation Data of a Selected IP address - by denilama - 03-16-2018, 08:29 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)