Last active
April 2, 2023 04:05
-
-
Save davebrny/101683d4b0277c9d4dd0b13ba82a4bba to your computer and use it in GitHub Desktop.
(autohotkey) - switch between the various time ranges (hour, day, week, month, year) π
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", , "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
this uses a two stage hotkey to switch between the time ranges
first use Β ctrlshift + l Β (the L key)
then press one of the following keys: h d w m y or 0
h = hour
d = day
w = week
m = month
y = year
0 = clear / reset
Β