{"id":812,"date":"2007-01-04T22:30:33","date_gmt":"2007-01-05T06:30:33","guid":{"rendered":"http:\/\/coalface.mcslp.com\/?p=40"},"modified":"2007-01-04T22:30:33","modified_gmt":"2007-01-05T06:30:33","slug":"controlling-os-x-volume-through-cron","status":"publish","type":"post","link":"https:\/\/planet.mcb.guru\/?p=812","title":{"rendered":"Controlling OS X volume through Cron"},"content":{"rendered":"<p>One of the biggest annoyances of working from home is that with the computers in the room next door, the volume of your computers can cause a problem if someone suddenly calls you on Skype, or your backup software suddenly kicks in and starts beeping. <\/p>\n<p>I <i>never<\/i> remember to mute the volume, so I started looking for a way to this automatically through cron at specific times. I also wanted to be sure that rather than setting a specific volume (and having to remember it), that I could just use the OS X mute function. <\/p>\n<p>The solution is to combine Applescript, which you can run from the command line using the osascript command, with the command line limitations of cron. <\/p>\n<p>There are three components, the two Applescripts that mute and unmute the volume, and the lines in a crontab to run the scripts. <\/p>\n<p>To mute the volume with Applescript: <\/p>\n<blockquote><pre>set volume with output muted<\/pre>\n<\/blockquote>\n<p>To unmute: <\/p>\n<blockquote><pre>set volume without output muted<\/pre>\n<\/blockquote>\n<p>Save both these into Applescripts (use the Applescript editor so they are compiled). <\/p>\n<p>Then we can just set the scripts to execute when required: <\/p>\n<blockquote><pre>0 9 * * * osascript \/usr\/local\/mcslp\/volume-unmute.scpt\n0 19 * * * osascript \/usr\/local\/mcslp\/volume-mute.scpt<\/pre>\n<\/blockquote>\n<p>I&#8217;ve set this on the three machines and now we get a silent night!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the biggest annoyances of working from home is that with the computers in the room next door, the volume of your computers can cause a problem if someone suddenly calls you on Skype, or your backup software suddenly kicks in and starts beeping.<br \/>\nI never remember to mute the volume, so I started [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[36],"_links":{"self":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/posts\/812"}],"collection":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=812"}],"version-history":[{"count":0,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/posts\/812\/revisions"}],"wp:attachment":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=812"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=812"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=812"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}