1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Applet to record battery strength every 30 minutes

Discussion in 'Windows XP' started by Prof Wonmug, Sep 2, 2010.

  1. Prof Wonmug

    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?
     
  2. Olórin

    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....?"
     
  3. Pegasus [MVP]

    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
     
  4. Eddie

    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
     

Share This Page