-
-
Save jasondavis/cc42cdca060ad2e8fe50f4e03a5016eb to your computer and use it in GitHub Desktop.
(autohotkey) - switch between the various time ranges (hour, day, week, month, year) π
This file contains hidden or 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", , "ahk_class #32770") | |
or WinActive("ahk_class MozillaWindowClass", , "ahk_class #32770") | |
^+l::goSub, google_time_range | |
#if | |
google_time_range: | |
send ^{l} | |
input, key_pressed, L1 T3, {0}{h}{d}{w}{m}{y}{esc} | |
if errorLevel contains escape,max,timeout | |
return ; ##################################### | |
new_range := "qdr:" . strReplace(errorLevel, "EndKey:", "") | |
stringLower, new_range, new_range | |
revert_clipboard := clipboardAll | |
clipboard = | |
send ^{l}^{c} | |
clipWait, 0.3 | |
if clipboard not contains www.google. | |
return ; ######################## | |
if inStr(clipboard, "qdr:") | |
{ | |
loop, parse, % "0|h|d|w|m|y", | | |
stringReplace, clipboard, clipboard, % "qdr:" a_loopField, % new_range, all | |
} | |
else clipboard .= "&tbs=" new_range | |
send ^{l}^{v}{enter} | |
clipboard := revert_clipboard | |
return | |
/* | |
[script info] | |
version = 1 | |
description = switch between the various time ranges (hour, day, week, month, year) | |
author = davebrny | |
source = https://gist.github.com/davebrny/101683d4b0277c9d4dd0b13ba82a4bba | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment