Tim,

Thanks for posting this.   I have several uses for this WMI module at my
work.


--Bill






On Mon, Jan 17, 2011 at 04:07, Tim Golden <m...@timgolden.me.uk> wrote:

> On 17/01/2011 03:01, FT wrote:
>
>> Is there a way to read the battery level using Python?
>>
>> I am totally blind and want to write a script to capture the battery
>> level and send it through the voice activeX so I can speak it...
>>
>
> WMI should be able to query the battery information:
>
> <code>
> import wmi
>
> c = wmi.WMI ()
> for battery in c.Win32_Battery ():
>  print battery.Caption, battery.EstimatedChargeRemaining
>
> </code>
>
> The pure-python wmi module is based here:
>
>  http://timgolden.me.uk/python/wmi/index.html
>
> and can be installed via easy_install / pip.
>
> Information on the attributes of the Win32_Battery class are
> available here:
>
>  http://msdn.microsoft.com/en-us/library/aa394074%28v=vs.85%29.aspx
>
>
> You might also be interested in the pyttsx project
> (successor to the Windows-specific pytts):
>
>  http://pypi.python.org/pypi/pyttsx/1.0
>
> although if you have existing code to work with an ActiveX
> control then I doubt it brings you any advantages.
>
> TJG
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to