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.

link|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
feedback

2 Answers

up vote 6 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::
WinGet, original, ID, A
WinActivate, Pandora 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.

link|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
feedback

Unfortunatly I do not do pandora itself, so here are thoughts to get you started or a Ball rolling?

I have used many input devices that I spent "way too long" configuring thier shorts, and keys and all. Working with many of the hooks and profiles for changing the input device to trigger what I want , then of course I do not USE them :-)
so . .For me the IDEA of mapping a key item, mouse button , even media keys or gestures. For Input devices that did not have good KB software, to a function in any program Should be a piece of cake? But each item presents its fun caveats and problems.

First I search the web, because I swear I have been using common easy to remember key shorts for flash (you Tube), net radio , win media programs, and all, basically the same ones I would use or map for a non-web media play. I also can control the key shorts in my browser (no conflicts).

I do not see any issue with sending out key commands to a program, running in the browser. http://www.eolsoft.com/freeware/flash_movie_player/help/tips.htm

Although there are MANY reports of others having problems like http://forums.adobe.com/message/4004239 ?? I keep testing things and (so far) it all works like it should here.

1) Can you use regular key items to control this web media?

2) Does the browser you use Conflict with , Alter Focus to, or effect the ability to send commands to the web media program (that really is only running off of your computer anyways , not some dust in the cloud :-) ?

3) Does your browser allow for passing focus to activeX programs?

4) Does your browser allow for mapping its own shortcut keys (to stop conflicts)?

5) Do you have unrealistic expectations that commands will be sent to this "program" when it is Not in focus? To control the media when it is backgrounded?

Stage 2

6) Did microsoft provide you any configuration software for the keyboards media keys? (side note: they do have a scanmap program linkHERE but I doubt that will help).

(Having fun yet) You may need one of the many utilities for key hooking and remapping, One that claims to work with the media keys , and goes beyond the limitations of the media keyboards softwares.
7) A search reveals a program called KeyTweak Key maping discussion That aledges to be able to configure media keys.

So, I do not understand why this is not possible (I believe Gman knows) Because most of my stuff cooperates, and when it doesnt some 3rd party hack will give it an attitude adjustement /*

Soo you could try to set/test that on your machine, with your favorite web site and test it, I would not have a way of doing that. or just answer some of my questions so I can understand more of the issues your facing.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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