none
Custom action once battery level is very low on Windows to use with Webhooks RRS feed

  • Question

  • Good morning dear community.

    Main objective behind what I am going to ask is to set a trigger once Windows is fullcharged or criticallylow.

    So in both cases I try with this VBScript being executed but don't seem to work in my windows

    set oLocator = CreateObject("WbemScripting.SWbemLocator") set oServices = oLocator.ConnectServer(".","root\wmi") set oResults = oServices.ExecQuery("select * from batteryfullchargedcapacity") foreach oResult in oResults iFull = oResult.FullChargedCapacity nextwhile (1) set oResults = oServices.ExecQuery("select * from batterystatus") foreach oResult in oResults iRemaining = oResult.RemainingCapacity bCharging = oResult.Charging next iPercent = ((iRemaining / iFull) * 100) mod 100 If bCharging And (iPercent > 98) Then MsgBox "Battery is fully charged",vbInformation, "Battery monitor" wscript.sleep 30000 ' 5 minutes wend

    This I got it from here www.addictivetips.com/windows-tips/get-alerts-when-your-laptop-battery-is-low-or-full/*

    Besides the main action that I would need is not really a notification but this cmd command

    curl -X POST https://maker.ifttt.com/trigger/ low_battery/with/key/d78hxxxxxxxx_WU_xxxU6

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

    A pseudo-code of something more or less like this perhaps

    If bCharging And (iPercent > 98) Then curl -X POST https://maker.ifttt.com/trigger/ low_battery/with/key/d78hxxxxxxxx_WU_xxxU6 , vbInformation, "Battery monitor"

    For that specific line.

    Is there a possibility to make it possible or even perhaps more easy like adding custom action once battery or low instead of sleep, shutdown and hibernate in energy options like to be able to execute a command or simply once windows reach battery at 5% execute the command above.

    Thank you :)

    Friday, September 27, 2019 4:56 PM

All replies

  • With a laptop pc,bothe batteries can be faulty,if so one needs to have the battery charger connected 100% of the time.If charger is not plugged in,plug in,wait 20 minutes before pc start up..To check battery condition(s),boot pc to BIOS..
    Wednesday, October 16, 2019 6:18 PM