• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

Applet to record battery strength every 30 minutes

P

Prof Wonmug

Flightless Bird
Where could I get an applet that would wake up every 30 minutes, read
the battery strength on my laptop, and write the results to a file?

I looked at several shareware apps that monitor the battery, but
didn't see any that can make a log.

Any suggestions or pointers?
 
O

Olórin

Flightless Bird
"Prof Wonmug" <wonmug@moo.gov> wrote in message
news:5og086d7657qqpmlolfocrgjs0mv6jkfu3@4ax.com...
> Where could I get an applet that would wake up every 30 minutes, read
> the battery strength on my laptop, and write the results to a file?
>
> I looked at several shareware apps that monitor the battery, but
> didn't see any that can make a log.
>
> Any suggestions or pointers?


"And your question about Windows XP is....?"
 
P

Pegasus [MVP]

Flightless Bird
"Prof Wonmug" <wonmug@moo.gov> wrote in message
news:5og086d7657qqpmlolfocrgjs0mv6jkfu3@4ax.com...
> Where could I get an applet that would wake up every 30 minutes, read
> the battery strength on my laptop, and write the results to a file?
>
> I looked at several shareware apps that monitor the battery, but
> didn't see any that can make a log.
>
> Any suggestions or pointers?


You could do it like this:
1. Save the code below as c:/Windows\BatteryMonitor.vbs
2. Create a scheduled task that runs once every 30 minutes. It should
execute the following command:
cscript //nologo c:/Windows\BatteryMonitor.vbs >>
c:/Windows\BatteryMonitor.log
3. Examine the log file c:/Windows\BatteryMonitor.log

Note that the battery interface appears to differ somewhat between
manufacturers. The code works on my Acer laptop but it may fail on your own
machine.

Set oWMIService = GetObject("winmgmts:/\.\root\CIMV2")
Set cItems = oWMIService.ExecQuery( _
"SELECT * FROM Win32_Battery",,48)
For Each oItem In cItems
sOutput = Date() & " " & Time() & ": " _
& "Remaining charge=" & oItem.EstimatedChargeRemaining & "%"
If oItem.BatteryStatus = 1 _
Then sOutput = sOutput & ", Remaining time=" & oItem.EstimatedRunTime & "
minutes"
WScript.Echo sOutput
Next
 
E

Eddie

Flightless Bird
Olórin wrote:
> "Prof Wonmug" <wonmug@moo.gov> wrote in message
> news:5og086d7657qqpmlolfocrgjs0mv6jkfu3@4ax.com...
>> Where could I get an applet that would wake up every 30 minutes, read
>> the battery strength on my laptop, and write the results to a file?
>>
>> I looked at several shareware apps that monitor the battery, but
>> didn't see any that can make a log.
>>
>> Any suggestions or pointers?

>
> "And your question about Windows XP is....?"
>
>

---------------------

If you look at Pegasus's reply, you will realise it is also about ppl
helping ppl.

Ed
 
Top