First: I loooove spotify.
Second: It has some flaws. I would like to be able to:
1. Use the built in hotkeys without activating the window.
2. Maybe create a GUI that shows what son is currently playing.
Can stuff like this be done at all?
I'd appreciate any push in a good direction to get me started.
Cheers!
Spotify and AHK
Started by
zzzztag
, Dec 08 2008 03:12 PM
37 replies to this topic
#1
-
Posted 08 December 2008 - 03:12 PM
Yes control send will work for this.
Heres the syntax:
Heres the syntax:
And heres an example of how you would use it for hotkeys:ControlSend [, Control, Keys, WinTitle, WinText, ExcludeTitle, ExcludeText]
ControlSend, , ^p, SpotifyThe first param is blank to send it to the window, then the hotkey to send then window title. The rest isn't that important for this.
#2
-
Posted 08 December 2008 - 03:27 PM
aboutscript ⋰ apps ⋱ scripts
Request Video Tutorials Here or View Current Tutorials on YouTube
Any code ⇈ above ⇈ requires AutoHotkey_L to run
Request Video Tutorials Here or View Current Tutorials on YouTube
Any code ⇈ above ⇈ requires AutoHotkey_L to run
trying to expand with a GUI that shows what is playing now.
This retrieves the info I need, but how can I put this into a GUI that auto-updates itself instead of a messagebox?
F10:: { WinGetTitle, now_playing, ahk_class SpotifyMainWindow StringTrimLeft, playing, now_playing, 10 MsgBox, Now playing: %playing% }
This retrieves the info I need, but how can I put this into a GUI that auto-updates itself instead of a messagebox?
#4
-
Posted 08 December 2008 - 11:23 PM
I recomend using traytip because its easy and can be seen in any window.
Heres an example of how to make a timed traytip:
Heres an example of how to make a timed traytip:
TrayTip, Timed TrayTip, This will be displayed for 5 seconds.
SetTimer, RemoveTrayTip, 5000
return
RemoveTrayTip:
SetTimer, RemoveTrayTip, Off
TrayTip
return
#5
-
Posted 08 December 2008 - 11:29 PM
aboutscript ⋰ apps ⋱ scripts
Request Video Tutorials Here or View Current Tutorials on YouTube
Any code ⇈ above ⇈ requires AutoHotkey_L to run
Request Video Tutorials Here or View Current Tutorials on YouTube
Any code ⇈ above ⇈ requires AutoHotkey_L to run
I'll have a look into the TrayTip. Never heard of it before.
This is my latest effort:
It gets the title, but I cant get it to change when I play new songs, and the first two hotkeys wont work as long as the gui is up.
This is my latest effort:
SetTitleMatchMode 2 F12::ControlSend, , ^{Right}, Spotify F11::ControlSend, , ^{Left}, Spotify F10:: { WinGetTitle, now_playing, ahk_class SpotifyMainWindow StringTrimLeft, playing, now_playing, 10 Gui,+AlwaysOnTop Gui, Add, Text,, %playing% Gui, Show }
It gets the title, but I cant get it to change when I play new songs, and the first two hotkeys wont work as long as the gui is up.
#6
-
Posted 08 December 2008 - 11:37 PM
SetTimer, RefreshTrayTip, 1000 Gosub, RefreshTrayTip ; Call it once to get it started right away. return RefreshTrayTip: WinGetTitle, now_playing, ahk_class SpotifyMainWindow StringTrimLeft, playing, now_playing, 10 TrayTip, Now playing:, %playing%., , 16 return
No matter what I do with the TrayTip function it only shows for a few milliseconds before it is closed.
#7
-
Posted 08 December 2008 - 11:55 PM
This works for me ...
; "WinKey + p" for previous #p:: DetectHiddenWindows, On ControlSend, ahk_parent, ^{Left}, ahk_class SpotifyMainWindow DetectHiddenWindows, Off return ; "WinKey + n" for next #n:: { DetectHiddenWindows, On ControlSend, ahk_parent, ^{Right}, ahk_class SpotifyMainWindow DetectHiddenWindows, Off return } ; "WinKey + q" for pause #q:: { DetectHiddenWindows, On ControlSend, ahk_parent, {Space}, ahk_class SpotifyMainWindow DetectHiddenWindows, Off return } ; "WinKey + 3" for info #3:: { DetectHiddenWindows, On SetTitleMatchMode 2 WinGetTitle, now_playing, ahk_class SpotifyMainWindow StringTrimLeft, playing, now_playing, 10 Gui,+AlwaysOnTop Gui, Add, Text,, %playing% Gui, Show DetectHiddenWindows, Off return }
#8
-
Posted 09 December 2008 - 12:12 AM
Are you sure it updates the GUI if you switch songs?
#9
-
Posted 09 December 2008 - 12:40 AM
Strange window update.
I used your example instead and added a test for song change ...
I used your example instead and added a test for song change ...
SetTimer, RefreshTrayTip, 1000 playingSave := "" Gosub, RefreshTrayTip ; Call it once to get it started right away. return RefreshTrayTip: WinGetTitle, now_playing, ahk_class SpotifyMainWindow StringTrimLeft, playing, now_playing, 10 if(playing != playingSave) { TrayTip, Now playing:, %playing%., , 16 } playingSave := playing return
#11
-
Posted 09 December 2008 - 01:03 AM
this keeps the traytip up at all times:
SetTitleMatchMode 2 #Persistent SetTimer, RefreshTrayTip, 1000 Gosub, RefreshTrayTip ; Call it once to get it started right away. return F12::ControlSend, , ^{Right}, Spotify F11::ControlSend, , ^{Left}, Spotify RefreshTrayTip: WinGetTitle, now_playing, ahk_class SpotifyMainWindow StringTrimLeft, playing, now_playing, 10 TrayTip, Now playing:, %playing%., 29 , 16 return
#12
-
Posted 09 December 2008 - 01:19 AM
getting there:
SetTitleMatchMode 2 #Persistent SetTimer, RefreshTrayTip, 1000 playingsave := "" Gosub, RefreshTrayTip ; Call it once to get it started right away. return ; "WinKey + p" for previous #p:: DetectHiddenWindows, On ControlSend, ahk_parent, ^{Left}, ahk_class SpotifyMainWindow DetectHiddenWindows, Off return ; "WinKey + n" for next #n:: { DetectHiddenWindows, On ControlSend, ahk_parent, ^{Right}, ahk_class SpotifyMainWindow DetectHiddenWindows, Off return } RefreshTrayTip: WinGetTitle, now_playing, ahk_class SpotifyMainWindow StringTrimLeft, playing, now_playing, 10 if(playing != playingsave) { TrayTip, Now playing:, %playing%., 10 , 16 } playingsave := playing return
#13
-
Posted 09 December 2008 - 01:27 AM
ok, happy with this for now
SetTitleMatchMode 2 #Persistent SetTimer, RefreshTrayTip, 1000 playingsave := "" Gosub, RefreshTrayTip ; Call it once to get it started right away. return ; "CTRL + LEFT" for previous ^Left:: DetectHiddenWindows, On ControlSend, ahk_parent, ^{Left}, ahk_class SpotifyMainWindow DetectHiddenWindows, Off return ; "CTRL + RIGHT" for next ^Right:: { DetectHiddenWindows, On ControlSend, ahk_parent, ^{Right}, ahk_class SpotifyMainWindow DetectHiddenWindows, Off return } ; "CTRL + UP" for info ^Up:: { DetectHiddenWindows, On SetTitleMatchMode 2 WinGetTitle, now_playing, ahk_class SpotifyMainWindow StringTrimLeft, playing, now_playing, 10 TrayTip, Now playing:, %playing%., 10 , 16 DetectHiddenWindows, Off return } RefreshTrayTip: WinGetTitle, now_playing, ahk_class SpotifyMainWindow StringTrimLeft, playing, now_playing, 10 if(playing != playingsave) { TrayTip, Now playing:, %playing%., 10 , 16 } playingsave := playing return
#14
-
Posted 09 December 2008 - 01:39 AM
Thanks for the script! But is there anyway to use OSD instead of traytip for the song information?
#15
-
Posted 04 January 2009 - 03:33 AM