How to Set the Volume When Logging In

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

  1. Launch System Preferences and select Power Manager.
  2. Click Add… to create a new event.
    Click the Add button to create a new Power Manager event.
  3. Choose the template Run a script daily.
    Choose the Run script daily task.
  4. Click Continue to the Script step.
  5. Copy and paste the following into the Script to run text box:

    osascript -e "set Volume 3"

    The volume can be set to a number between 0 (silent) and 10 (loudest).

    Copy and paste in the set volume AppleScript.
  6. Click Continue until you reach the Why step. There is nothing to change in the When and Constraints steps.
  7. Give the event a title and add a note about the purpose of the event in the Why step.
    Give your new event a name and add notes about its purpose.
  8. Click Continue and then Add to create the new event.
    Click Add to confirm and create the new Power Manager event.
    An event to set the volume once a day has been created.

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.

  1. Open the event in the event editor; hold down the Option and double-click on your event.
    Double-click the event with the Option key held down.
  2. Delete the daily trigger; select the Trigger's Action cog > Delete….
    Delete the existing Daily Trigger using the Action pop-up menu.
    The event after the Daily Trigger has been deleted.
  3. Add a log in trigger; select Add a trigger > Log In.
    Add a Log In trigger using the Add a trigger pop-up menu.
  4. Click Save to save the changes to the event.
    Set volume event with the Log In trigger added.
    The new set volume Power Manager event is ready.

Your new Power Manager event to set the volume is now ready and will perform each time a user logs in.

This article was posted in , , , and and tagged .

Published by Graham Miln on