Chances are, at one time or another, you have raised the volume on your Mac and forgotten to quieten it afterwards. That next alert, bleep, or song played at full volume was unwelcome at best.
In a busy environment, such as a lab or business, being able to ensure the Mac's volume is set at a reasonable level when a user logs in is essential.
You can programmatically change a Mac's system volume through AppleScript. We are going to use this ability to create an event in Power Manager. The event will be triggered when a user logs in, and will perform a small volume setting AppleScript.
Let's walk through how to create a log in triggered AppleScript.
Create a Run AppleScript at Log In Event
We are going to divide this recipe into two sections. The first will use the Schedule Assistant to create a daily AppleScript event, and finally we will modify this event by adding a log in trigger.
Create a Daily AppleScript Event
- Launch System Preferences and select Power Manager.
- Click Add… to create a new event.
- Choose the template Run a script daily.
- Click Continue to the Script step.
Copy and paste the following into the Script to run text box:
#!/bin/sh osascript -e "set Volume 3"
The volume can be set to a number between
- Click Continue until you reach the Why step. There is nothing to change in the When and Constraints steps.
- Give the event a title and add a note about the purpose of the event in the Why step.
- Click Continue and then Add to create the new event.
An event containing the volume setting AppleScript has now been created. This event is set to trigger once a day.
Add a Log In Trigger to the Event
We need to modify the event to trigger when a user logs in, instead of performing once a day. To do this, we are going to use the event editor.
- Open the event in the event editor; hold down the Option and double-click on your event.
- Delete the daily trigger; select the Trigger's Action cog > Delete….
- Add a log in trigger; select Add a trigger > Log In.
- Click Save to save the changes to the event.
Your new Power Manager event to set the volume is now ready and will perform each time a user logs in.