Don’t forget to Follow Me on Twitter
Countless nights, I would be laying in bed when my iMac would announce “It’s 11 o’ clock” from one room over. I had been listening to music or watching some video and left my volume up. Now, I was forced to either walk to the other room to turn it down or deal with Adium chimes and time announcements all night while trying to fall asleep.
Or.. I could reach over to my nightstand and grab my omnipresent smart phone and mute it from there. To do this, you will need to write two simple scripts.
Update: Check out the Updated Article for a much simpler way to do all of this.
The first script is used to set the volume of the computer to the lowest value. Name the file “.mute.scpt” and place the file in the Sites directory in your home folder. The file contains just one line to set the volume to 0.
set Volume 0
This number is variable and you could use the steps in this guide for any number. In fact, I have scripts named “loud”, “louder” and “loudest”.
The second script is to run the previous script from the web. Since this file is an OSX script, it could be run in any number of ways. I, however, wanted a “button” on my iPhone to mute my iMac so I set up a script I could access through mobile Safari. In the same directory as the previous script (Sites) create “mute.php”
<?php exec(“osascript .mute.scpt”); ?>
Note: You may need to enable PHP. I’ve found a good guide here.
Okay, the scripts are in place. How do you access them?
First, you must make sure that you have Web Sharing enabled by opening the Sharing panel in System Preferences.
Once this is enabled and you are on the same network as your Mac, you will be able to access the script from your mobile phone by going to the following address in your web browser
Here is the only “iPhone only” part of this post:
You can then simply bookmark the page and add it to your homescreen and you have a “Mute Computer” button on your iPhone!