Hi friends,
Recently, I got a new battery for my Dell laptop and was wondering how to use the battery in the most efficient way. I then got to read a Quora anwser by Shubham Deshmukh as to how to use the battery in the most efficient way where he suggested to keep the battery percentage between 40 and 60 to get a longer battery life. This made me think about writing a script that monitors my battery and pops a message box alerting me when the battery percentage goes beyond the above range. The present script monitors the battery status every half hour which can be changed as per your requirement.
The two if conditions determines whether the battery is above 60% and below 40% respectively and pops a message box with the appropriate information.
Information to run the script:
You are required to paste the above code into a text editor and save it as any_name.vbs (set the save as dialogue to save as 'all files'). Save this file to any location of your choice and create a shortcut for it by clicking right and selecting the 'Create Shortcut' option. Next, you need to paste the created shortcut in your start-up folder to avoid the need to run it manually every time.
Hey man, it's Aakash from the email conversation that we had the other day. I just wanted to know how you got to know where and what library you'd have to use to write an administrative script and how to develop this kind of script fast? I mean I don't think you'd have sat through the entire MSDN documentation for this, did you?
ReplyDeleteHi Aakash,
ReplyDeleteI didn't read the complete documentation obviously. I little of Google search and the following links (https://gist.github.com/0xABD/1591886, https://gallery.technet.microsoft.com/scriptcenter/b96bd8b5-64af-4c3d-aea9-e2de22611109, http://www.tek-tips.com/viewthread.cfm?qid=1614797) and a few more helped me get what I wanted.
Hi Krishna, In your code, The sleep for the script is not correct:
ReplyDeletewscript.sleep 180000 ' 5 minutes => 180000 milli seconds is 3 mins and not 5 mins. Just add one more zero to correct it.
Currently your script is getting executed every 3 mins and not every half an hour as you have mentioned. Just FYI. Thanks.
ReplyDeleteThanks @Krishna Chaurasia. I have used this script in automating my own Laptop Battery charging process.
ReplyDelete