Can i turn of volume at 6-10 pm?

And turn on at 10-10 am. By script.


I would probably do it this way, save this script and assign it to be an iCal alarm at 10.10 am and 6.10 pm. Make both events recurrent. I use iCal alarms to trigger scripts everyday and it’s pretty reliable.

--set volume to maximum value by default, value can be from 0 (mute) to 7
set my_volume to 7
set today_date to (get current date) as string
set seconds_since_midnight to time of date today_date
--if total seconds since midnight > 64800 (18*3600= 18:00 or 6pm) then volume will be set to 0
if seconds_since_midnight > 64800 then set my_volume to 0
--set the actual volume value
set volume my_volume

Hi stefcyr,

Why don’t you just turn off the volume at 6-10 PM and on at 10-10 AM with a script or Automator workflow?


Model: MBP
AppleScript: 2.2.3
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)

Kel, to tell the truth I’m not really familiar with automator workflows. I guess it could also be done using Cron (which I never used). As I mentioned, I use iCal when I want to schedule a script to run by itself. I just thought of using one single script that would define the appropriate volume level based on the actual time it’s being triggered. I also set the “mute” time to 6pm (or later but before midnight) but since it should run at 6.10pm it should be fine. But as for many tasks, there’s often many different ways to do things. What would you precisely do?

Hi stefcyr,

I don’t know if your iCal can run compiled scripts. Calendar can only run script applications, so I think I’d rather run an Automator workflow or two just setting the volume to zero or whatever. Then I don’t get the app bouncing in the dock. I like simple so I think I’d run two compile scripts or workflows. To each their own.


Yep, iCal can run compiled AppleScripts. I just tried that very same code as an iCal alarm (added a “Beep 3” line to the end of the script) and sure enough, it beeped 3 times on time and no dock bouncing icon. I’m using iCal 4.0.4 on 10.6.8. Give it a try :slight_smile:

Hi stefcyr,

They changed things here in Mountain Lion with Calendar. You can’t run compiled scripts. But you can run workflow applications that run in the background or Calendar alarms. Nice script though.


That explains it Kel, thanks for the heads up.

Hi Termitter,

There’s not enough information.


stefcyr, many thanks! no i know, how to use timing in other tasks ))