Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
2  
Unlikely, 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 Dec 18 '11 at 18:15
    
@Gman, never underestimate the power of a macro. ;) –  iglvzx Dec 19 '11 at 6:56
    
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 Dec 19 '11 at 16:36
1  
@gman, You'd be surprised. See my answer. :) –  iglvzx Dec 23 '11 at 23:43
add comment

2 Answers 2

up vote 20 down vote accepted
+50

I have cooked up a solution using AutoHotkey. It takes a bit to set up, but it is worth it!

Setup:

  1. Download and install AutoHotkey_L

  2. Create a new .txt file. Rename it to have the .ahk extension.

    new file

  3. Right-click the file and select Edit Script.

    edit script

  4. Input the following:

    #InstallKeybdHook
    
  5. Save.

  6. Right-click the file again, this time selecting Run Script.

    run script

    The script is active as indicated in the Windows tray:

    tray icon

  7. Right-click the tray icon and select Open.

    open script

  8. Press your play/pause key. The keystroke has been logged.

  9. From the menu, select View > Key history and script info.

    view menu

  10. 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.

    scan code

  11. Open up Pandora.com in Google Chrome.

  12. Press Ctrl+L to select the Address Bar.

  13. 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.

    pandora focus

  14. Right-click the AutoHotkey tray icon and select Exit. We are done with the setup!

The Script:

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.

share|improve this answer
    
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 Dec 24 '11 at 21:15
    
Let me know if you run into any problems. I'll help you sort them out. You're welcome. :) –  iglvzx Dec 24 '11 at 21:25
2  
+1 for awesome presentation. :) –  Lamb Dec 24 '12 at 13:19
1  
This 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 Jun 10 at 17:57
    
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. –  starbox Jul 9 at 17:39
add comment

http://www.daveamenta.com/2010-06/pandora-one-media-keys-enable-them/ This guy created a .exe that maps the media keys for you.

share|improve this answer
    
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 Feb 27 at 18:19
    
This works with normal pandora too - I'm using it my media remote and it works perfectly –  user325977 May 23 at 1:23
    
@user325977 How? It doesn't work for me on my Windows 7 work computer with Pandora running in IE. –  Firefeather May 29 at 18:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.