PowerSource XFcn

Here is where the magnanimous folks that create externals post them (.zip archives only please).

PowerSource XFcn

Postby Dave_Higgins » Fri Sep 17, 2010 10:12 am

Returns Number Of Power Sources (batteries), and Power Remaining (%).

powerSource("numberOfPowerSources")
powerSource("powerRemaining")

If numberOfPowerSources = 0 then powerRemaining return -1, so you can check for powerRemaining > 0 if not using numberOfPowerSources.

BatteryLevel.sc45.zip
Returns Number Of Power Sources (batteries), and Power Remaining (%).
(34.2 KiB) Downloaded 311 times
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: PowerSource XFcn

Postby Dave_Higgins » Fri Sep 17, 2010 3:41 pm

I see a couple/few have grabbed this one... How's it working out? I tested it on a MacBook Pro (model just prior to unibody).

Later on, when I can spend some time with it, I'll add some more features... In the functions used for this there are many more keys available providing info that may be of interest. You can see them if you check out the file "IOPSKeys.h" (which you will find a few of with a Spotlight search).

There is a mix of Battery and UPS functions in there, so some of them won't apply to internal battery info.
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: PowerSource XFcn

Postby Dan_Kelleher » Fri Sep 17, 2010 6:16 pm

It works well here.
On The Dual G4 WorkStation it reports 0 Sources and Power Remaining = -1
On a powerBook running under the most recent SC Player it reports sources = 1 and Power Remaining = 27 which is identical to the report in the menuBar and both values decrease w time since the ps is not plugged in.
Congratulations ! The check is in the mail. ;)
Daniel.Kelleher@umassmed.edu
SC4.7.3 OSX 10.7.2 Mac Pro
User avatar
Dan_Kelleher
 
Posts: 438
Joined: Sun Jul 06, 2008 2:45 pm
Location: Worcester (wouster as in would) Massachusetts USA

Re: PowerSource XFcn

Postby Dave_Higgins » Fri Sep 17, 2010 9:43 pm

KelleherD wrote:Congratulations ! The check is in the mail. ;)

Guess I should have mentioned that it's BeerWare!

:cheers:
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: PowerSource XFcn

Postby Didier Gross » Fri Sep 17, 2010 11:29 pm

Dave Higgins wrote:Guess I should have mentioned that it's BeerWare!


Hi Dave, didn't have time to check it for now, but here's the beer:
Image

Please note it's the original one, not the US localization :mrgreen:

Cheers!
Didier Gross
 
Posts: 47
Joined: Thu Sep 16, 2010 11:32 pm
Location: City of god Lug

Re: PowerSource XFcn

Postby johnjohnston1 » Sat Sep 18, 2010 1:16 am

Hi Dave,
does what is says on the tin:
Number Of Power Sources = 1
Power Remaining = 99

which reflect the menu. Tried it last night with a different but equally accurate reading.

cheers

john
User avatar
johnjohnston1
 
Posts: 196
Joined: Sun Jul 06, 2008 10:42 am
Location: Glasgow, UK

Re: PowerSource XFcn

Postby Anderson » Sat Sep 18, 2010 5:42 am

Dave,
All power levels reporting as expected.
Thanks.
Anderson.
iMac - Yosemite - SC(4.73)
User avatar
Anderson
 
Posts: 207
Joined: Mon Jul 21, 2008 9:00 am
Location: Perth County, Canada

Re: PowerSource XFcn

Postby Dave_Higgins » Sat Sep 18, 2010 6:47 am

Didier Gross wrote:Hi Dave, didn't have time to check it for now, but here's the beer:

Please note it's the original one, not the US localization :mrgreen:

Cheers!


Cool. A "Bud Right" :)
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: PowerSource XFcn

Postby Didier Gross » Sat Sep 18, 2010 8:43 am

Dave,

Checked here on a MacBook 2GHz Intel Core 2 Duo.

Works as a charm. You may drink the beer.

Dave Higgins wrote:Cool. A "Bud Right" :)


Not enough skilled in English to catch this one. Requiring "Puns for dummies" or some explanation...
Didier Gross
 
Posts: 47
Joined: Thu Sep 16, 2010 11:32 pm
Location: City of god Lug

Re: PowerSource XFcn

Postby Dave_Higgins » Sat Sep 18, 2010 7:43 pm

Didier Gross wrote:Not enough skilled in English to catch this one. Requiring "Puns for dummies" or some explanation...

Ahh. Well, the most popular "version" of Budweiser here is "Bud Lite".
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon


Return to XCmds, XFcns, and XRtns

Who is online

Users browsing this forum: No registered users and 1 guest

cron