16
8
I have a Microsoft keyboard with a play/pause button. Is there a way I can map the play/pause key to the Play/Pause button on the Pandora website?
I use Chrome as my browser and am running Windows 7.
16
8
I have a Microsoft keyboard with a play/pause button. Is there a way I can map the play/pause key to the Play/Pause button on the Pandora website?
I use Chrome as my browser and am running Windows 7.
22
I have cooked up a solution using AutoHotkey. It takes a bit to set up, but it is worth it!
Download and install AutoHotkey_L
Create a new .txt
file. Rename it to have the .ahk
extension.
Right-click the file and select Edit Script
.
Input the following:
#InstallKeybdHook
Save.
Right-click the file again, this time selecting Run Script
.
The script is active as indicated in the Windows tray:
Right-click the tray icon and select Open
.
Press your play/pause key. The keystroke has been logged.
From the menu, select View > Key history and script info
.
Toward the bottom, you will see some information about the recent keystroke. We are interested in the SC
(Scan Code). In my case, it was 122
.
Open up Pandora.com in Google Chrome.
Press Ctrl+L to select the Address Bar.
Now, press Tab multiple times until the focus has been moved to Pandora's play/pause button. Keep count! In my case, it took 10
tabs.
Right-click the AutoHotkey tray icon and select Exit
. We are done with the setup!
Create and run the following script, in the same manner as Steps #2-6 above. Replace XXX
in the 1st line with your scan code, and replace YY
in the 5th line with your tab count.
SCXXX::
SetTitleMatchMode, 1
WinGet, original, ID, A
WinActivate, Pandora Internet Radio
Send ^l
Send {Tab YY}
Send {Space}
WinActivate, ahk_id %original%
Exit
Now, when you have Pandora.com open and you press your play/pause key, the script will click play/pause on Pandora.com and return you back to where you were.
This would be better if it worked from other programs. Using this causes problems if I have a different window open, like Excel. If I have the pandora window open, it's easy enough to click with my mouse. – Veridian – 2014-07-09T17:39:07.953
Great Idea iglvzx!!! I had problems with IE11 where IE wasn't resetting the current tab stops after the <ALT>D. So I just had autohotkey click inside the window and then send a space. – Eric L – 2014-08-31T13:08:12.957
Thanks a lot. I can't test this right now, but I really appreciate the effort, so I'll assume it works and give you the bounty. Thanks! – itzy – 2011-12-24T21:15:43.137
Let me know if you run into any problems. I'll help you sort them out. You're welcome. :) – iglvzx – 2011-12-24T21:25:34.323
2This works if I'm on the Pandora tab, but not from other programs. I'm using Firefox, and have a Pandora paid subscription (so the tab's title is different). What do I need to modify to get this to work? – mouseas – 2014-06-10T17:57:40.220
5
http://www.daveamenta.com/2010-06/pandora-one-media-keys-enable-them/ This guy created a .exe that maps the media keys for you.
This only works with the Pandora One desktop application on Windows -- not with Pandora running in a web browser -- but this happens to be what I was looking for, and I can verify that it does work (on Windows 8.1), so thanks! – Jon Schneider – 2014-02-27T18:19:15.783
This works with normal pandora too - I'm using it my media remote and it works perfectly – None – 2014-05-23T01:23:14.743
1@user325977 How? It doesn't work for me on my Windows 7 work computer with Pandora running in IE. – Firefeather – 2014-05-29T18:53:41.763
1
This is a little older, but I have some to offer a solution for those who do not want to write code. I wrote an application that lets you map your keys to Pandora. Check it out I call it Pandora Keys the application itself is open source so you can edit it if needed. It has some other neat features which are outlined on the website.
Disclaimer: I am the author of this application.
This works well for me, thank you. Just an FYI for others: This does use Internet Explorer. – Heptite – 2015-09-29T17:10:04.683
Another note: It lets you skip ads! Just press the >>
button on your keyboard. – Heptite – 2015-11-04T00:55:02.900
@Heptite Author here. Thanks for the comment, it does support media keys, or you can also define your own shortcut keys. I should mention the source code is also available at https://github.com/SamPlusPlus/Pandora-Keys since the accepted answer does talk about writing your own script.
– Sam Plus Plus – 2015-11-04T16:35:08.023Forgive me, but I'm confused. I'm aware it does support media keys; that's why I installed it. – Heptite – 2015-11-04T18:47:21.787
@Heptite sorry I didn't mean to confuse you. I was just trying to make the distinction that it can support media keys like actual play or pause buttons, but you could also set your own keyboard shortcuts like saying Ctrl + N skips. I was only trying to make the point that the keyboard shortcuts are flexible. Anyways I am glad you are enjoying the software. Feel free to let me know if I can make improvements. – Sam Plus Plus – 2015-11-04T20:49:03.537
0
This Auto Hotkey script worked for me, for the Web Version of Pandora (in Chrome). The script searches for the active window title with the word "Pandora", sends the space bar keystroke to Pause/Play, then minimizes the window, returning to your original window. The "SetTitleMatchMode, Slow" helps the script better identify hidden windows.
This example sets the "Pause/Break" key as the Pause Button, and Alt + "Pause/Break" will go to the next song. To change the button, use the key idenitfier method above and replace "SC045" with that Key.
The "Sleep, 50" improves performance by slowing down the script a little bit. If you find that sometimes that the script does not work, try adding more time in these lines: ex. "Sleep, 75"
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SC045::
SetTitleMatchMode, 1
SetTitleMatchMode, Slow
WinGet, original, ID, A
WinActivate, Pandora
Sleep, 50
Send {Space}
Sleep, 50
WinMinimize, Pandora
Sleep, 50
WinActivate, ahk_id %original%
Exit
!SC045::
SetTitleMatchMode, 1
SetTitleMatchMode, Slow
WinGet, original, ID, A
WinActivate, Pandora
Sleep, 50
Send {Right}
Sleep, 50
WinMinimize, Pandora
Sleep, 50
WinActivate, ahk_id %original%
Exit
2Unlikely, they'd have to have a special event listener in their JS/Flash to recognize media keys and without some crazy client-side trickery, I don't see this as feasible. Not to mention there's the issue of window focus, since it is a Flash app and not registered with the OS as a media player, I don't foresee a way to achieve this when the window is in the background. – Garrett – 2011-12-18T18:15:15.050
@Gman, never underestimate the power of a macro. ;) – iglvzx – 2011-12-19T06:56:55.960
How do you suppose you'd give the specific window/tab focus through a macro? Also there would be a fair amount of trickery necessary to write an event handler that to custom map the media key functions. No commercial software from Microsoft/Logitech/etc. is capable of doing this as described. – Garrett – 2011-12-19T16:36:49.210
1@gman, You'd be surprised. See my answer. :) – iglvzx – 2011-12-23T23:43:07.530