Hi Again, Bad form to reply to my own post, but I just wanted to make clear that I meant I can't claim credit, not the other way round. The Spell Checker failed me in this instance. Silly missing T. Best, Zack. On Mar 28, 2011, at 4:28 AM, Zachary Kline wrote:
> Hi All, > Someone posted a while back in search of an Apple script to get the battery > status on a MacBook. I've gone into the list archives and found this, which > I've bound to right-option-b in the keyboard commander. I can' claim credit > for it, but I hope its useful to anyone who wants it. It's pasted below. > Make sure you format it properly when getting this into AppleScript Editor. > Hope this helps, > Zack. > > -- Cut here... > (* This Apple script will querie for the battery status and speak the output. > This script works best when associated with a keyboard shortcut and used in > conjunction with VoiceOver. *) > on isVoiceOverRunningWithAppleScript() > set isRunning to true > -- is AppleScript enabled on VoiceOver -- > tell application "VoiceOver" > try > set x to bounds of vo cursor > on error > set isRunning to false > end try > end tell > return isRunning > end isVoiceOverRunningWithAppleScript > 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 & "%" > if isVoiceOverRunningWithAppleScript() then > tell application "VoiceOver" > output "Battery " & battPct & "%" > end tell > else > say "Battery " & battPct & "%" > end if > > -- > You received this message because you are subscribed to the Google Groups > "MacVisionaries" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/macvisionaries?hl=en. > -- You received this message because you are subscribed to the Google Groups "MacVisionaries" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/macvisionaries?hl=en.
