16

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.

JdeBP
  • 27,556
  • 1
  • 77
  • 106
itzy
  • 213

4 Answers4

22

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.

iglvzx
  • 23,818
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.

john
  • 51
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.

enter image description here

enter image description here

enter image description here

Disclaimer: I am the author of this application.

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