Search
Photos
« AppleScript, Export iCal Birthdays to Remind | Main | AppleScript, "Open Safe Files" Folder Action »
Friday
Oct282005

Mute/unmute the sound


I absolutely love Mac OS X for that behind the cute facade there's an even more beautiful thing called unix. Combine the power of unix shell with wide adoption of AppleScript and you can achieve pretty much anything. For example, to automatically mute the sound at night, just do the following:


1. Start the Terminal

2. Open crontab for editing using the following command:

$ crontab -e


3. Now copy these two lines into the editor:

0 1 * * * osascript -e 'tell application "System Events" to set volume with output muted'
0 6 * * * osascript -e 'tell application "System Events" to set volume without output muted'


4. Save and quit and you're done. This will mute the sound at 1:00AM and un-mute it at 6:00AM.


Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>