In the last 20 years, we have seen how the technology behind batteries has barely evolved. In fact, we could safely say that it has not evolved in the slightest. What has evolved is the use made of electronic components, some components that have managed to considerably reduce energy consumption to offer greater autonomy with the same battery capacity.
The batteries of both laptops and mobile devices lose capacity as charging cycles are completed. Each manufacturer indicates different guidelines for charging the battery so that it lasts as long as possible. This is due to what we have discussed at the beginning of this article, since the technology inside the batteries remains the same, and each manufacturer has traditionally established different conservation guidelines. The only thing that all manufacturers seem to agree on is that using a laptop with a battery always connected is a bad idea.
The solution of some manufacturers is to implement a functionality that is automatically responsible for deactivating the battery charge when we reach 100%. In this way, the heating of the battery is reduced, one of the main problems related to its wear. If when we get home, we have the habit of continuing to work with the laptop and, incidentally, take the opportunity to charge the battery, we can make use of this little trick to know when the battery reaches its maximum capacity or is about to do so, and thus disconnect the charger.
It’s time to unplug the charger
If we want Windows to display a message on the screen informing us that the maximum battery level has been reached and that the time has come to disconnect the charger, we can use the script that we show you below, a script that we must copy and paste into the Notepad app.
- set oLocator = CreateObject(“WbemScripting.SWbemLocator”)
- set oServices = oLocator.ConnectServer(«.», »rootwmi»)
- 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 > 99) Then msgbox “Battery is at ” & iPercent & “%”,vbInformation, “Battery monitor”
- wscript.sleep 30000 ‘ 5 minutes
- wend
This script will show us the informative message “The battery is at 99%” when the battery reaches 99 (iPercent > 99). We can modify the penultimate line so that, instead of informing us at 99%, it informs us at 100%, at 90% at 95% or whenever we want.
Next, we save the file with the name we want and close the application. Next, we rename the file and add (if it doesn’t have an extension) or modify the extension to be .vbs. Next, we must place this application in the Windows start menu so that, every time the system runs, when the established battery level is reached, it shows us a notification.