Display Alert when Laptop is fully charged

You can display standard warning message when your laptop battery becomes low beyond threshold level but reverse is not true.

It would be better if there would be in-built solution to display warning when laptop battery becomes full so that we can switch-off the power button which would increase the laptop battery life.

Since there is no build-in solution as of today, we have a custom solution in vb.net for you which is very simple. Just follow below simple steps-

  • Open notepad.
  • Paste below script in notepad and save it as ‘FullBattery.vbs’.
set oLocator = CreateObject("WbemScripting.SWbemLocator")
set oServices = oLocator.ConnectServer(".","root\wmi")
set oResults = oServices.ExecQuery("select * from batteryfullchargedcapacity")
for each oResult in oResults
   iFull = oResult.FullChargedCapacity
next

while (1)
  set oResults = oServices.ExecQuery("select * from batterystatus")
  for each 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"
  wscript.sleep 30000 ' 5 minutes
wend
  • Press Windows+R to open the “Run” dialog box.
  • Type “shell:startup” and then hit Enter to open the “Startup” folder.
  • Create a shortcut for FullBattery.vbs and paste here in the “Startup” folder. It will open on startup the next time you boot.

Preview:

Published by Sandeep Kumar

He is a Salesforce Certified Application Architect having 11+ years of experience in Salesforce.

Leave a Reply