Go Back   MacRumors Forums > Apple Hardware > Notebooks > MacBook Air

Thread Tools Search this Thread Display Modes
Old Aug 5, 2012, 04:11 PM   #1
macrumors member
Join Date: Jun 2009
Battery Uptime Usage for Macbook Air

I have created a very simple Applescript to help me analyze battery uptime usage for my new 2012 11" i7/8/256 Air running ML.

I wanted to confirm my battery uptime and thought others might be interested in doing the same. The script refreshes any website over and over again automatically. For my test I have set the screen brightness at 50% and keyboard backlight about 20%, no bluetooth, running ML.

1) Make sure you Macbook is fully charged (100%) and you have setup energy saver so that the computer and display never sleep for this test.

2) Turn your keyboard backlight and screen brightness to a desired level

3) Unplug the power connector

4) Copy Applescript (below) to Applescript Editor (you can find this undder Utilities) under and click RUN. I have a youtube video setup to refresh every 60 seconds. Feel free to update this to any youtube or automatic streaming URL and you can change the delay time.

5) Every 60 seconds "Uptime log.txt" (written to the desktop) will be updated with the current date time and the battery level at that time.

6) Let your macbook run until the battery is exhausted

7) Now when the macbook restarts you can view the output file and calculate the time difference from the first entry and the last to get you uptime.

During several tests my fans were running about 2000rpm.

I am averaging about 4:30 - 4:45 hours of uptime constantly streaming a youtube video.

Hope this help anyone wanted to confirm their uptime battery usage.

Here's the Applescript I am using (cut and paste this to your Applescript Editor)

-- Insert any URL as desired
open location "http://www.youtube.com/watch?v=AcLCfUutnnI"

-- Set any delay to a desired value. Every 60 seconds the file Uptime log.txt will be updated
delay 60

set thePath to (path to desktop as Unicode text) & "Uptime log.txt"

set fRef to (open for access file thePath with write permission)
set myDate to date string of (current date)
set myTime to time string of (current date)
set myDatetime to myTime & " " & myDate
write myDatetime to fRef starting at eof

set maxCapacity to do shell script "ioreg -w0 -l | grep \"\\\"MaxCapacity\\\" =\""
set maxLevel to the last word of maxCapacity
set curCapacity to do shell script "ioreg -w0 -l | grep \"\\\"CurrentCapacity\\\" = \""
set curLevel to the last word of curCapacity
set battPct to round (100 * curLevel / maxLevel)
set output to " : Battery " & battPct & "%"
write output & return to fRef starting at eof

end try
close access fRef

end repeat
rmastbro is offline   0 Reply With Quote

MacRumors Forums > Apple Hardware > Notebooks > MacBook Air

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iPad: iPad Air - post your battery usage Guitarpik iPad 101 Jun 17, 2014 02:34 PM
Which 13" MacBook Air/Pro For My Usage? gregpod9 Buying Tips and Advice 14 May 26, 2014 07:46 AM
App to monitor Air actual battery usage? MrGimper Mac Applications and Mac App Store 0 Oct 19, 2013 01:48 PM
Macbook Air vs Macbook Pro for my usage Xisdibik Buying Tips and Advice 3 Jun 18, 2013 09:55 AM
Macbook Air vs Macbook Pro Screen - And overall usage... blanco.juanfeli MacBook Pro 6 Sep 9, 2012 10:21 PM

Forum Jump

All times are GMT -5. The time now is 09:16 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2015, MacRumors.com, LLC