Skip to content

Instantly share code, notes, and snippets.

@davebrny
Last active February 26, 2018 18:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davebrny/964e124eb1655675a657755215a77906 to your computer and use it in GitHub Desktop.
Save davebrny/964e124eb1655675a657755215a77906 to your computer and use it in GitHub Desktop.
(autohotkey) - load the root url of the current webpage
#if WinActive("ahk_class Chrome_WidgetWin_1") ; chrome
or WinActive("ahk_class MozillaWindowClass") ; firefox
!r::goSub, root_url
#if
root_url:
revert_clipboard := clipboardAll
clipboard =
send ^{l}
send ^{c}
clipWait, 0.5
root_url =
if (inStr(clipboard, "https://twitter.com/search?") = 1)
root_url := "https://twitter.com/search-home"
else if (inStr(clipboard, "https://gist.github.com") = 1)
root_url := "https://gist.github.com/davebrny"
else splitPath, clipboard, , , , , root_url ; every other url
if (root_url != "")
{
clipboard := root_url
send ^{l}
send ^{v}{enter}
}
clipboard := revert_clipboard
return
/*
[script info]
version = 1
description = load the root url of the current webpage
author = davebrny
source = git.io/vMeK2
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment