Last active
February 26, 2018 18:31
-
-
Save davebrny/964e124eb1655675a657755215a77906 to your computer and use it in GitHub Desktop.
(autohotkey) - load the root url of the current webpage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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