[python-win32] Fetching Battery Monitor Data
Roger Upole
rupole at hotmail.com
Tue Jan 18 14:34:47 CET 2011
"FT" <chester_lab at fltg.net> wrote in message
news:2B602B53D89E450ABF2B9DA00081CE1B at 1B1B1L1...
>
> Hi Mark,
>
> I could not find using Google any information on how to get the Laptop
> Battery Level information so I could have my Screen Reader Or voices from
> Sapi to talk the information.
> So, I would need the modules or a sample code that fetches the data
> from that location on the screen.
> I figure I could study the code and learn how to do it after getting
> the information.
> I have already posted information on other lists about using PYTTS but
> would like to have information on getting batter info and work up from
> there.
>
> Sincerely
> Bruce
You can use WMI to get the battery level.
import win32com.client
wmi=win32com.client.GetObject('winmgmts:')
b=wmi.InstancesOf('win32_battery')
print b[0].EstimatedChargeRemaining
Roger
More information about the python-win32
mailing list