Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasondavis/cc42cdca060ad2e8fe50f4e03a5016eb to your computer and use it in GitHub Desktop.
Save jasondavis/cc42cdca060ad2e8fe50f4e03a5016eb to your computer and use it in GitHub Desktop.
(autohotkey) - switch between the various time ranges (hour, day, week, month, year) πŸ”Ž
#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