Archive for the Apple Script Category

Quicksilver’s iTunes plugin comes with several excellent scripts, one of them is to mute iTunes.

The only problem is, that you can still hear all the system sounds. Pretty annoying if you are in a meeting or sitting in a class.

My workaround was to write an Apple Script to control the system volume:

set curVol to (get (output volume of (get volume settings)))
if curVol > 0 then
  set volume output volume 0
else
  set volume output volume 50
end if

This script will mute the system volume, or set it back to 50% if it’s already muted (the value for “set volume” is a percentage value from 0 to 100).

That’s it, I created a keyboard trigger to execute this script (I used Shift-Ctrl-Command + M) and I can mute my system without having to use the mouse or trackpad.

Using a Microsoft keyboard with a MacBook is possible but has one major drawback: The “Option” and “Command”-keys are exchanged and called “Windows” and “Alt”-keys.

Fortunately swapping the keys so that the “Command” and “Option”-keys are in the same location like on an Apple keyboard is very simple:

  1. Open your “System Preferences”
  2. Select “Keyboard & Mouse”
  3. Select the “Keyboard”-tab
  4. Click on “Modifier Keys…”

In the resulting dialog map the Option Key to “Command” and vice versa. This is a screenshot made with Tiger, the dialog in Leopard looks a little bit different:

Key Mappings

Voila - that’s it. Now the Microsoft keyboard should behave just like an Apple keyboard.

Now, for one additional problem (if you are still using Tiger or before):

I am using my MacBook Pro in my office, so I’m frequently connecting and disconnecting my keyboard. Since my external keyboard is an ergonomic keyboard with Microsoft keys I would have to change those settings each and every time I connect or disconnect the keyboard. This is only the case if you’re still using Tiger or before, because in Leopard you can set the keys for each keyboard type as shown in this screenshot: Keyboard settings in Leopard

One solution is an AppleScript, which I found on the following website:

Change keyboard modifier keys automatically on OSX with Applescript

Now I have a Quicksilver Trigger to execute this Applescript, which makes the swapping of the “Command” and “Option”-keys quick and painless!

Nocturne, a nifty little application from the creator of Quicksilver, let’s you switch the display of your Mac into night vision mode:

This “night vision mode” is more than just a toy - there are situations when it comes in very handy! I like to use it in meetings and presentations where the light in the room are dimmed down. In those situations, the “night vision display” makes the display more comfortable for my eyes and reduces the annoyance of the bright laptop display for other people in the room.

The only drawback to Nocturne is that (to my knowledge) it doesn’t have an easy way to toggle between night vision and normal display with Quicksilver - so here is my solution:

Once Nocturne is set to “night vision” it will remember this setting and switch the display immediately when invoked. So all I needed was an application that would start Nocturne if it’s not running and quit Nocturne otherwise. A short apple script does this job for me:

tell application “System Events”
  if exists process “Nocturne” then
    try
      quit application “Nocturne”
    end try
  else
    try
      open application “Nocturne”
    end try
  end if
end tell

You can download this script here: toggleNocturne

That’s it. Save this script as an application and define a keyboard trigger in Quicksilver (I used Shift-Control-Command-N) to invoke it.