AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Spotify Global Hotkeys

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Sansana



Joined: 04 Jan 2009
Posts: 1

PostPosted: Sun Jan 04, 2009 10:45 pm    Post subject: Spotify Global Hotkeys Reply with quote

Hello,
I know there's a topic like this already, but in Ask for help section, and I believe this is a more fitting place for this. This tiny script is based on zzzTAG's script from this topic http://www.autohotkey.com/forum/topic38617.html .

It's basically a global hotkeys script which includes a little clipboard extra feature. It covers all playback hotkeys such as: previous, next, play/pause, volume up, volume down and mute. The little extra feature I've mentioned above allows you to copy current song's name (Artist - Title) to clipboard - I think it's a very useful thing Smile

Here's the code:
Code:
SetTitleMatchMode 2

; "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 pause
^UP::
{
DetectHiddenWindows, On
ControlSend, ahk_parent, {space}, ahk_class SpotifyMainWindow
DetectHiddenWindows, Off
return
}

; "CTRL + DOWN"  for info
^Down::
{
DetectHiddenWindows, On
SetTitleMatchMode 2
WinGetTitle, now_playing, ahk_class SpotifyMainWindow
StringTrimLeft, playing, now_playing, 10
DetectHiddenWindows, Off
clipboard = %playing%`r`n
return
}

; "CTRL + PAGE UP"  for volume up
^PgUP::
{
DetectHiddenWindows, On
ControlSend, ahk_parent, ^{Up}, ahk_class SpotifyMainWindow
DetectHiddenWindows, Off
return
}

; "CTRL + PAGE DOWN"  for volume down
^PgDn::
{
DetectHiddenWindows, On
ControlSend, ahk_parent, ^{Down}, ahk_class SpotifyMainWindow
DetectHiddenWindows, Off
return
}

; "CTRL + END"  for mute
^End::
{
DetectHiddenWindows, On
ControlSend, ahk_parent, ^+{Down}, ahk_class SpotifyMainWindow
DetectHiddenWindows, Off
return
}


Here's the program : http://rapidshare.com/files/179823740/spotify_autohotkey.exe.html

The keys goes like this:

Previous - Ctrl + Left
Next - Ctrl + Right
Play/Pause - Ctrl + Up
Copy song name to clipboard - Ctrl + Down
Volume up - Ctrl + Page Up
Volume down - Control + Page Down
Mute - Control + End

Enjoy!
Back to top
View user's profile Send private message
michaelJ
Guest





PostPosted: Sun Jan 11, 2009 11:50 pm    Post subject: Reply with quote

Very convenient. Thank's alot.
Back to top
Elias
Guest





PostPosted: Wed Feb 04, 2009 9:25 pm    Post subject: Reply with quote

Link is dead? Sad
Back to top
ibr



Joined: 12 Aug 2009
Posts: 5
Location: Norway

PostPosted: Wed Aug 12, 2009 1:15 pm    Post subject: Reply with quote

Great script, I was looking at a VB.NET class that does the same, but it cannot change song (next/previous) without focusing the window. AutoHotKey never stop to impress me Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group