barndog
barndog

Reputation: 7173

Mute computer programmatically

I'm developing a free app for OS X that mutes your computer on a schedule. The idea behind it is so if you're in a meeting or class, you can just run the app and be sure that it won't make noises. The problem is, I don't know how to mute the system volume. Any help?

Upvotes: 2

Views: 986

Answers (2)

Paul R
Paul R

Reputation: 212979

In AppleScript you can just do this:

set volume output volume 0

(The volume is a value from 0 to 100, where 0 is "mute" and 100 is full volume.)

You could just create an applet containing this one line of code, and have it run on schedule from iCal as needed.

Or if you really want to then you could create a full-blown Cocoa app where you would just need to run the above code using NSAppleScript. It seems a bit like overkill though.

Upvotes: 7

Related Questions