1

I am using Mac OS El Capitan on my macbook pro and have just installed Power Manager following your recommendations elsewhere on this website (see Low Battery Alert for Mac OS X El Capitan).

However, I see only an option to power down the computer when the battery charge falls below a specified level. I would like to simply display a pop-up warning on the screen along with a sound alarm and, if continued unheeded for a few minutes, put the laptop to sleep instead of powering down. I guess the way to achieve this would be a script; could you send me such a script indicating wherever I have to insert my preferred parameters? Thanks.

5
  • In the question above, I meant to say "...display a warning message with a sound alarm...." . I don't know if that is possible, but just in case it is....
    – Ram
    Commented Apr 18, 2018 at 9:34
  • 1
    Please edit your question instead of adding a comment. While doing so please also add a link to the original question you are referring to.
    – nohillside
    Commented Apr 18, 2018 at 12:35
  • Sorry, my first time on this site. I was trying to find a way to edit my post but couldn't find the edit option that is visible now. Anyway, I did edit the post, but don't see what needs to be linked, as the edit is in the text itself.
    – Ram
    Commented Apr 20, 2018 at 12:26
  • Ram, you mention "have just installed Power Manager following your recommendations elsewhere on this website.", adding the URL of this recommendations will make it easier to get the complete picture.
    – nohillside
    Commented Apr 20, 2018 at 12:28
  • Thanks for clarifying Patrix, I've added the URL and explained the edit as well this time. I'm learning!
    – Ram
    Commented Apr 20, 2018 at 14:01

1 Answer 1

1

Below are the steps to creating an event to run an AppleScript when the battery level drops below 30%:

  1. Power Manager > File (menu) > New Empty Event;
  2. Double-click new Untitled event to open in editor;
  3. Add a trigger > Power Remaining > Battery 30% Left
  4. Add an action > Run Script > AppleScript
  5. AppleScript action > Cog > Edit
  6. Copy and paste in the AppleScript below
  7. Apply then Save

AppleScript to copy and paste into event:

#!/usr/bin/osascript
try
    with timeout of 10 seconds
        display dialog "Your battery has dropped below 30%" with icon caution buttons {"OK"} default button 1
        say "Low battery" 
    end timeout
on error -- likely timeout
    tell application "Finder" to sleep
end try

I wrote Power Manager. If you need support for Power Manager, please get in touch via [email protected].

Power Manager low power warning

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .