rMBP battery script

Discussion in 'MacBook Pro' started by Rics, Mar 3, 2013.

  1. Rics, Mar 3, 2013
    Last edited: Mar 3, 2013

    Rics macrumors newbie

    Jan 11, 2011
    Hi, yesterday i went to an apple store asking for assistance on "vintage" MBP (yep, they will not give assistance on 4 or 5 y/o products) and i took advantage to ask the best battery usage for my new rMBP.

    He said me that the best practice is to let the battery electrons flow as much as possible and to not use the laptop always connected to the power AC adapter.

    So he adviced me to always cycle 0<->100% (though i've read on the web also to make a 50<->100% half cycle) to get the best battery capacity along more time.

    Got this advice i tought "ok, i'll do", but at the same time i tought also "well, ok, i'm working all day long with my laptop, when it's going under 20% battery capacity OSX alerts me with an alert window, but when i connect the laptop to the A/C adapter and raise to 100% full charge, i could easily forget it as i could be so deeply busy in work to not check the battery level on the top right corner, or totally lack of care at the battery led! (yes, it could sound strange, but we are humans, strange things can happen!!!:D)"

    "I need an alert also when i get 100% battery level!"

    I took the plunge and i tought to automator!
    By surfing here and there on the web i've found the way to make a conditional script that alerts me when the battery is under 5% and when is over 99%, including voices, beeps and window alerts.

    Here it is:

    set Cap to (do shell script "ioreg -w0 -l | grep ExternalChargeCapable")
    tell Cap to set {wallPower} to {last word of paragraph 1}
    set Cap to (do shell script "ioreg -wO -l | grep Capacity")
    tell Cap to set {Available, Max} to {last word of paragraph 2, last word of paragraph 1}
    set Pct to round (100 * Available / Max)
    if Pct ≥ 99 
    	set volume 3
    	beep 2
    	do shell script "say -v \"Alex\" \"Disconnect the charger, your laptop is fully charged, 100%!\" "
    	display dialog "Disconnect the charger, your laptop is fully charged, 100%!"
            else if Pct ≤ 5
    	set volume 3
    	beep 2
    	do shell script "say -v \"Alex\" \"Connect the charger, your laptop is under 5%\""
    	display dialog "Connect the charger, your laptop is under 5%"
    	end if
    end if
    Now where's my problem? Running it constantly.

    Could be this app/workflow used as background process that checks every 'n' time the battery status?
    Something like the "unknow always present" processes that you see into the activity monitor app?

    Thank you!!
  2. Cergman macrumors 6502a


    Jan 1, 2013
    my tesla
    I like the idea, but I find that having that would be slightly annoying. Also, your battery cycle count would go way up in just a few months. I have my computer plugged in when at my desk, and on battery when anywhere else. I have had my computer for almost 4 years and the battery is not in the greatest state, but purchasing a new computer soon anyway.
  3. GGJstudios macrumors Westmere


    May 16, 2008
    You don't need to be alerted when your battery is fully charged, as it will automatically stop charging when it's full. You don't need any script for controlling your battery.

    Run on battery whenever you need to and plug it in whenever you can. You can plug or unplug any time you need to, regardless of the charged percentage, and you never need to completely drain your battery. Just make sure you don't run on AC power exclusively, as your battery needs to be used regularly to stay healthy.

    If yours is an older removable battery, be sure to calibrate it monthly to keep your battery readings accurate. The procedure is in the CALIBRATION section of the link below.

    The link below should answer most, if not all, of your battery/charging questions. If you haven't already done so, I highly recommend you take the time to read it.
  4. thejadedmonkey macrumors 604


    May 28, 2005
  5. swerve147 macrumors 6502a

    Jan 12, 2013
    Just unplug it and let it run down to 50% or less whenever you remember to, then plug it back in. No need to constantly monitor it or do it on a schedule (although I consciously do it at least once per week).
  6. major major macrumors newbie

    Mar 3, 2013
    Bad Advice from Apple Store

    Hi, I think your Apple Store guru is giving bad advice about cycling batteries.
    Apple only recommends cycling at most once per month. (And I personally would not cycle at all.)

    Wear and tear on Lithium based batteries (as are used in all modern laptops)
    is primarily due to
    1. Use
    2. Storage at 100% charge in warm environments
    3. Deep Discharge

    #1 and #3 can be mitigated by keeping plugged in as much as possible,
    and a recent thread
    tries to get at #2.

    For good data on lithium batteries see:
  7. GGJstudios macrumors Westmere


    May 16, 2008
    You already posted this nonsense in another thread. Read my response there.
  8. Rics thread starter macrumors newbie

    Jan 11, 2011
    Hi guys, thank you all for the replies!
    I was afraid of this battery topic just because i'm going to use my rMBP as a desktop replacement: as freelance i collaborate with different studios, so i needed a powerful computer that at the same time gave me portability as one day i could stay on a studio and another day i could stay in a different studio.
    I can't ask to buy a single mac pro/imac/macmini to each single studio, and i prefer to have my computer with me when i work from home, so i will rarely use it unplugged and from what i've heard in the last years, using a laptop always plugged to the power isn't a good practice.
    That's why i asked to an "apple guru" an advice, and as he's hired by apple, and i buy products from apple, i expect that he gives right advices!


    The "apple guru" said me to disconnect always the recharged plug after the battery capacity reached 100% level. (And that's why i've tried to create the script.)
    That would be my normal use of course, sometimes happens that i will use my rMBP unplugged, but you know, i asked to an official apple assistant and usually i follow what is said by who sold me a computer.
    Your advice at this point could be achieved by a simple iCal reminder, of course if in a week, or month or more, i use it always connected to the plug.
    Nope, rMBP.
    I'll read it immediately. thnaks for the link.

    Thanks for the advice, will compare it with the official documentation that GGJstudios linked.

    So, at the end seems that the "apple guru" gave me a sorta of bad advice.
  9. GGJstudios macrumors Westmere


    May 16, 2008
    That's true.
    It's important to remember than "Genius" is only their job title, and not necessarily an indication of their knowledge, experience or expertise. Like any company, some employees are knowledgeable and great at their job, some are poor performers, some just don't care, and some are new on the job and still learning.
    I missed where you said that earlier. That's definitely bad advice, as it burns up cycles needlessly, always running on battery power when AC power is available.
    Yep, an iCal reminder would work great. When it reminds you, just unplug the MBP and run on battery a few hours, then plug it back in. Do that a few times a week and you'll be fine.
  10. Rics thread starter macrumors newbie

    Jan 11, 2011
  11. bili.d.kid macrumors member

    Mar 2, 2013
    open the system report while its fully charge and still connect to power magsafe.its not charging, so its ok to leave it plug although its full 100% i guess.just remember to calibrate twice a month at least.
  12. GGJstudios macrumors Westmere


    May 16, 2008
    The built-in batteries in the newer Mac unibody notebooks come pre-calibrated and do not require regular calibration like the removable batteries in older Apple notebooks.

    Even on older models that do require calibration, it's not recommended to do so more frequently than once per month.
  13. bili.d.kid macrumors member

    Mar 2, 2013
    then why do they told us to do that in this webpage http://www.apple.com/batteries/notebooks.html
  14. GGJstudios macrumors Westmere


    May 16, 2008
    Please quote where Apple tells you to calibrate a built-in battery. They don't. Read the links I provided to get the facts.
  15. bili.d.kid macrumors member

    Mar 2, 2013
    Standard Maintenance
    For proper maintenance of a lithium-based battery, it’s important to keep the electrons in it moving occasionally. Apple does not recommend leaving your portable plugged in all the time. An ideal use would be a commuter who uses her notebook on the train, then plugs it in at the office to charge. This keeps the battery juices flowing. If on the other hand, you use a desktop computer at work, and save a notebook for infrequent travel, Apple recommends charging and discharging its battery at least once per month. Need a reminder? Add an event to your desktop’s iCal. When your battery no longer holds sufficient charge to meet your needs, you may choose to replace it. If your notebook came with a built-in battery, you should have the battery replaced only by an Apple Authorized Service Provider.

    but i miss not reading this http://support.apple.com/kb/HT1490?viewlocale=en_US&locale=en_US from you though. now i know, and makes me confuse :)
  16. GGJstudios macrumors Westmere


    May 16, 2008
    Simply charging and discharging the battery is not the same as calibration. That quote means you should put at least one cycle per month on a notebook battery if you use the notebook infrequently. That does not apply to a notebook that's in regular use.
  17. bili.d.kid macrumors member

    Mar 2, 2013
    oh my.. so that is what its mean.i guess i have to read everything carefully, thanks for helping me to understand this.
  18. Queen6 macrumors 604


    Dec 11, 2008
    Flying over the rainforest at dawn - Priceless
    By far the most practical advice, exactly what I do setting a reminder for every week, I just pull the power cord and let the battery run down 20-30 percent.

Share This Page