Shutdown when on battery

jc001

Beta member
Messages
4
Location
UK
[FONT=&quot]I am very new to the world of laptops (always been a PC user) so not sure if this is possible but I thought I'd ask.
I have a laptop that runs on AC power for half of the day doing various tasks. If there was a power cut and I am about (within the building for example) I would quickly come and shutdown the laptop without the battery completely being drained running this task. My question is, is there anyway a batch, vbs or a free program that I can use so when I am not about, checks/monitors to see what the power source is and when a power source has changed from AC to battery mode, within 2 minutes being on battery, safely runs a shutdown command (shutdown -s) so that at least it shutdowns correctly and not through a battery been drained and damaging the HDD and the laptop. I am on XP but it's going to be soon replaced by Windows 7. I am new to programming so please bear with me if you do have any batches or vbs?
Many thanks.[/FONT]
 
All Windows laptops can be configured to provide you with various low-battery warnings. Furthermore, you can configure Windows to automatically hibernate or shut down your laptop when the battery gets way too low. In Windows XP, follow these directions to set various battery warnings:

Open the Control Panel's Power Options icon.
Click the Alarms tab.
Place a check mark by the item Activate Low Battery Alarm When Power Level Reaches.
Use the slider to set the battery percentage level for the Low Battery alarm.
Ten percent seems like a good level.
Click the Alarm Actions button.
Choose what happens when the alarm kicks in.
For example, specify Sound Alarm or Display Message. Add an action, such as Hibernate, Sleep, or Shut Down.
Click OK to close the Alarm Actions dialog box.
Repeat Steps 3 through 7 for the Critical Battery alarm.
Click OK to close the Power Options Properties dialog box.

It might make no sense to have options for low and critical battery levels when the laptop is plugged in, but consider what happens when the battery is charging: If you plug in a laptop when its battery is low and the Plugged In setting for Critical Battery Action is set to Shut Down, the laptop turns itself off even when it's plugged in.
 
Many thanks for the reply. Is this not possible via a batch or a vbs script that monitors battery level change and then after a 2% drop shuts down the laptop down?
 
Yes and no. I saw the settings in control panel but I was asking/checking if it is possible via a script instead. Since the reply, I have found a batch that monitors battery level change every 10 mins (which works) and then when the battery does change % it writes an event and then the event will trigger on an event ID a shutdown command. Since posting this I have learnt I will now be running via a pc instead of a laptop so the control panel is changed altogether (boss now wants me on a pc instead) which will run on a UPS. However, the UPS software (Powerchute) wont install on the pc (someone elses problem not mine so reasons I dont know so cant ask why it wont) my question now is I still require it to be shutdown via command, so if running a batch on a pc every 10 mins will this be OK or will it slow down my pc or affect the CPU in the process in any way.
 
Yes and no. I saw the settings in control panel but I was asking/checking if it is possible via a script instead. Since the reply, I have found a batch that monitors battery level change every 10 mins (which works) and then when the battery does change % it writes an event and then the event will trigger on an event ID a shutdown command. Since posting this I have learnt I will now be running via a pc instead of a laptop so the control panel is changed altogether (boss now wants me on a pc instead) which will run on a UPS. However, the UPS software (Powerchute) wont install on the pc (someone elses problem not mine so reasons I dont know so cant ask why it wont) my question now is I still require it to be shutdown via command, so if running a batch on a pc every 10 mins will this be OK or will it slow down my pc or affect the CPU in the process in any way.

Well it'll take up some resources. Your CPU will determine how much it affects other tasks. Your storage drives and RAM will also be used but all depends on how good they are. Running a simple script shouldn't take so much resources thoug. What are your specs?
 
You will want to use Autoit for this. You can read progressbars, interfaces, and system processes. Depending on what programs you are running you should be able to deal with your problem. Its very basic (that is why its called "Basic Like"), but very effective.
Bit of a learning curve but not too difficult.
Also, you might consider the Ram load from compiled scripts. If your only going to be using it on your own machine, that wont matter to much as you may not need to compile anything. Still, keep all that in mind.
EDIT: And also ask questions on the forum. The more you ask the faster you will learn.

I hope this helps.
 
Last edited:
Many thanks for all the replies. I have sorted it and with some testing there is a script that runs every x min that checks if it's on AC or the battery power. If it's on the battery, it will shutdown the laptop within a certain timeout. So far it hasn't shown any problems with the CPU and resources and has been working OK. Thanks again all.

Note: That link you provided Draygoes takes you to http://www.computerforums.org/forums/www.autoitscript.com. I did come across the correct link however. Thanks.
 
Back
Top Bottom