Microsoft Keyboard on Mac to control Spotify

Republished from February 11, 2015 @ 1:54pm

I’m using a Microsoft 4000 Keyboard on a Mac and I use Spotify to play music more than I use iTunes. By default the Play/Pause button on the Microsoft 4000 keyboard will only tell iTunes to Play/Pause. The Microsoft system preferences app does not allow me to send a key stroke to a specific app, nor does Spotify specify a key stroke for Play/Pause. This solution would probably be super hacky for anyone else, but I’m already using something called BetterTouchTool that allows me to control mouse buttons (non-Apple mouse in my case) and keystrokes globally as well as within specific applications.

The first step is to create an Applescript to tell the desired application to play/pause. Below is an Applescript that tells the running application (Spotify first, then looks for iTunes) to play/pause. If neither Spotify nor iTunes are running, then launch Spotify and tell it to play. Note that Spotify will only play upon launch if it was playing when it stopped, so the play may not actually happen when it is launched.

You can also use the single statement below to affect only Spotify:

Now set the keyboard to issue some unused keystroke when the play/pause button is pressed. Open System Preferences -> Microsoft Keyboard

Select the “Key Settings” tab and highlight “Play/Pause”, then click the “Reassign” Button.


Under “Select a command:” choose “Keystroke”. Click in the “Press a key” text box and press some unused key combination. I chose Control-Command-Shift-k. While that may be used for something, I will never press that key combo.


Now, press the “OK” button and close the System Preferences.

The last step is configure BetterTouchTool. Open BTT preferences.

  1. For “Application” select “Global”
  2. On the bottom right chose “+ Add New Shortcut”.
  3. Click in “Keyboard Shortcut” and push the Play/Pause button on the keyboard which should enter the assigned key combination chosen in the keyboard preferences.


  1. The dropdown under “Trigger Predefined Action:”
  2. Select the “Controlling Other Applications” section
  3. Chose “Open Application / File / Applescript…” and browse to your saved Applescript.


Close BetterTouchTool and test your Play/Pause button.

If you did not have BTT set up before starting, you may need to set it to launch automatically as well as other preferences. Check those to ensure it will continue to work the way you want.

Microsoft Keyboard on Mac to control Spotify
Tagged on: