Contribute
Register

Volume & iTunes Keyboard Controls Tutorial

Status
Not open for further replies.
Joined
Jun 28, 2010
Messages
72
Motherboard
Gigabyte Z68XP-UD3
CPU
i7 > Need full CPU name > See Forum Rules!
Graphics
GTX 970
Mac
  1. MacBook
Mobile Phone
  1. iOS
*Update: Well someone just told me about bytecontroller, http://bytetastic.com/, which is a basically a free and easier way to set up iTunes controls on your keyboard. I still recommend using ControllerMate in conjunction for the native volume controls as bytecontroller only controls the iTunes volume and ControllerMate you can assign the native osx volume controls.*

In this tutorial I'll be showing you how to turn your ordinary keyboard into one that has the ability to change volume and control iTunes using the 'F' keys or any other keys you decide.

Shortly after building my first hackintosh I wanted to retain my old Dell Quietkey keyboard but take advantage of the volume and iTunes controls, one of my favorite features of OSX.

After googling around for a bit I discovered you could do this by using the application ControllerMate (http://www.orderedbytes.com/controllermate/). You'll need to purchase the full version in order to utilize all the buttons I'm going to document. You have a minimum amount of buttons you can set up in the shareware version.

I've gone and set my keys as:

F6: Previous iTunes track
F7: Play/Pause
F8: Next iTunes track

Print Screen: Toggle Mute On/Off
Scroll Lock: Volume down
Pause/Break: Volume up

You can of course set these to any keys you wish to use, I selected these because they are my least used keys.

The first step is to open controllermate.

Hit the programming tab on the main window.

Add a new page. Screen Shot 2012-06-18 at 7.45.58 AM.png

Select the new page.

Open up the palette.

Select controllers and select your keyboard.

From here you can drag the keys you intend to use onto the gridded field of the new page you just created. It should look something like this: Screen Shot 2012-06-18 at 7.51.25 AM.png

*Note: For some reason with my latest hackintosh with Lion installed I wasn't able to get all 6 keys working. One would always not work when I closed ControllerMate. To remedy this I just added a new page and put my 6th control onto that page and then all 6 worked like a charm. This is why you don't see my F6 in my screenshot.

Now that you have your keys dropped in we can add our commands.

For volume and mute toggling you will navigate to the 'Keystrokes Palette'. Screen Shot 2012-06-18 at 7.55.18 AM.png

Once this comes up you can drag the volume and mute keys into the grid and literally attach it to your key you already have in there: Screen Shot 2012-06-18 at 7.56.35 AM.png

Once you have those arranged you can test it and they should work properly.

Now that you have your volume keys set up let's move onto the iTunes controls.

Go to the main palette and navigate to 'Apple Script'. You can drag a regular script onto the grid. Go ahead and attach this to the button you selected for 'previous track'.

Now you need to bring up the inspector.

When you have your empty script selected it should look like this in the inspector: Screen Shot 2012-06-18 at 8.01.10 AM.png

Now all you need to do is make sure 'Store script in building block' is selected and paste in the following script:

'tell application "iTunes"
play (previous track)
end tell'

Then hit 'Update status'.

Your previous track button should now be set up and you can go ahead and use the following scripts for play/pause and next track.

Play/Pause:

'tell application "iTunes"
if player state = playing then
pause
else
play
end if
end tell
'

Next Track:

'tell application "iTunes"
play (next track)
end tell'

And that's about it. All your buttons should be working properly and you can even close the application and not have to worry about it again.

Hopefully someone finds this useful. If you have any questions or if I made any mistakes go ahead and let me know.

:headbang:
 

Attachments

  • Screen Shot 2012-06-18 at 7.45.58 AM.png
    Screen Shot 2012-06-18 at 7.45.58 AM.png
    1.4 KB · Views: 376
  • Screen Shot 2012-06-18 at 7.51.25 AM.png
    Screen Shot 2012-06-18 at 7.51.25 AM.png
    437.1 KB · Views: 446
  • Screen Shot 2012-06-18 at 7.55.18 AM.png
    Screen Shot 2012-06-18 at 7.55.18 AM.png
    48.2 KB · Views: 377
  • Screen Shot 2012-06-18 at 7.56.35 AM.png
    Screen Shot 2012-06-18 at 7.56.35 AM.png
    12.4 KB · Views: 381
  • Screen Shot 2012-06-18 at 8.01.10 AM.png
    Screen Shot 2012-06-18 at 8.01.10 AM.png
    25.7 KB · Views: 371
JulianLoscombe said:
Hi

I use Byte controller, it's completely free and you can program the keys: http://bytetastic.com/ (1st download)

It's great.

Julian

hmph well that nearly renders this tutorial useless, lol thanks. the native volume controls are still convenient though since byte controller just controls the iTunes volume. but i'm definitely using this too, the growl style notifications are awesome too.
 
eelhead said:
Still a good guide though and thanks for posting it :)

thanks! :D

i wasn't able to find much support on this when i originally set up controllermate so i figured i'd share how i had it set up.
 
I might be missing something here, but I believe bettertouchtool also does the same thing
http://blog.boastr.net/

with a much more simple interface and a lot more options, I'm running it both on my MBA and hackintosh at home. a nice default feature is that you can enable window snapping (a la windows 7 style) I'm away from my hackintosh right now, but I enabled all my function keys on my Logitech Solar Keyboard (they also have Mac version now) mapped with native functions, though it might be a limitation of BTT, but when I'm playing starcraft II, I can't stop itunes sometimes so that is annoying. I don't want to steal any attention from your solution, just pointing out a potentially free alternative!
 
Thanks so much! I've been looking for how to do this for a while!!!! I'm about to try it out, will post how it goes.

EDIT: It worked! Much better than Better Touch Tool, which requires that the application is open.

Does anyone know whether my keys will still work if I uninstall ControllerMate?
 
Status
Not open for further replies.
Back
Top