Skip to content

Instantly share code, notes, and snippets.

@davebrny
Last active October 24, 2017 14:24
Show Gist options
  • Save davebrny/21b9f8147c82e66c913226ec6a8bc229 to your computer and use it in GitHub Desktop.
Save davebrny/21b9f8147c82e66c913226ec6a8bc229 to your computer and use it in GitHub Desktop.
🎧 (autohotkey) - search operator hotstrings for spotify
#if winActive("ahk_exe Spotify.exe")
or winActive("Spotify ahk_exe chrome.exe")
or winActive("Spotify ahk_exe firefox.exe")
:*:a;:: ; album
:*:ar;:: ; artist
:*:t;:: ; track
:*:g;:: ; genre
:*:y;:: ; year
:*:l;:: ; label
:*:u;:: ; user
stringTrimLeft, operator, a_thisLabel, 3
for what, with in { "a;":"album:"
, "ar;":"artist:"
, "t;":"track:"
, "g;":"genre:"
, "y;":"year:"
, "l;":"label:"
, "u;":"spotify:user:" }
stringReplace, operator, operator, % what, % with, all
if operator contains year:,user:
send % operator "{space}{left}"
else send % operator """""{space}{left 2}"
return
:*:y1;:: ; select 1st year
:*:y2;:: ; select 2nd
last_year := a_year
envSub, last_year, 1
send % "year:" last_year "-" a_year
if a_thisLabel contains y1
send {left 5}
send +{left 4}
return
:*:and;:: ; convert booleans to upper case
:*:or;::
:*:not;::
stringUpper, spotify_boolean, % regExReplace(a_thisLabel, "[\W]")
send % spotify_boolean . a_space
return
:*:new;::send tag:new ; new albums
#if ; end of spotify windows active
/*
[script info]
version = 1.5
description = search operator hotstrings for spotify
author = davebrny
source = https://gist.github.com/davebrny/21b9f8147c82e66c913226ec6a8bc229
*/
@davebrny
Copy link
Author

spotify search operators

all hotstrings end with a ; semi-colon

trigger result
a; > album:
ar; > artist:
t; > track:
g; > genre:
y; > year:
l; > label:
u; > spotify:user:
 
y1; > year: 2015-2016   (select 1st)
y2; > year: 2015-2016   (select 2nd)
 
and; > AND (boolean)
or; > OR
not; > NOT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment