How to Shutdown/turnoff a laptop by plugging out its charger? - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Programming
Click Here to Login
Reply
 
Thread Tools Display Modes
 
Old 01-21-2014, 06:09 AM   #1 (permalink)
Newb Techie
 
Join Date: Jan 2014
Location: Australia
Posts: 19
Default How to Shutdown/turnoff a laptop by plugging out its charger?

Hey guys,
I have also posted this question on another section because i didn't know which section to choose. so far this forum has been helpful for me so i thought i should post this question here.
So how can i shutdown a laptop by plugging out its charger?
I want a laptop to shutdown automatically as soon as its charger was plugged out.
if u know it, please tell me how and note that i need this method for a machine not personal use. thanks.
__________________

__________________
JordanWhiteG is offline   Reply With Quote
Old 01-21-2014, 08:06 AM   #2 (permalink)
Slacking Guru
 
Slacker's Avatar
 
Join Date: Jan 2012
Location: placetoplace
Posts: 307
Default Re: How to Shutdown/turnoff a laptop by plugging out its charger?

You could try Power Options in control panel.
Then click "Change Plan Settings" for your active plan.Then Select "Change Advanced Power Settings".
Scroll down to "battery" and expand it.
Expand "Low Battery Level" and change the "on battery" to a higher precent 95%

Then expand "Low batter action" and change "on battery" to shutdown...


Maybe that is what you are looking for?
__________________

__________________
Alt + Delete + Control = problem solved
"Thinking is easy, acting is difficult, and to put one's thoughts into action is the most difficult thing in the world."
Johann Wolfgang von Goethe




Slacker is offline   Reply With Quote
Old 01-21-2014, 07:20 PM   #3 (permalink)
Newb Techie
 
Join Date: Jan 2014
Location: Australia
Posts: 19
Default

thanks alot buddy i tried that before and it works but is there anyway to make an application for it?

and i don't want the laptop to turn on while the charger is plugged out.

I tried taking out the whole battery, but that's not safe and everytime it goes on safe mode and ETC.
__________________
JordanWhiteG is offline   Reply With Quote
Old 01-21-2014, 07:41 PM   #4 (permalink)
Private Joker
 
carnageX's Avatar
 
Join Date: Feb 2007
Location: South Dakota
Posts: 24,707
Default Re: How to Shutdown/turnoff a laptop by plugging out its charger?

Quote:
Originally Posted by JordanWhiteG View Post
thanks alot buddy i tried that before and it works but is there anyway to make an application for it?

and i don't want the laptop to turn on while the charger is plugged out.

I tried taking out the whole battery, but that's not safe and everytime it goes on safe mode and ETC.
For making an application you could do it in several different languages.

Do you know any programming languages, or are you needing something written?

If you know C#, you can watch system events. You could also use AutoHotKey to detect if the system is on battery, and then shutdown. Those are just 2 languages I know could probably do it - I'm sure there's other libraries out there that have power state functionality (such as C++).
__________________
Laptop: MSI GT70 2OC-059us | i7-4700MQ | 16GB | GTX 770m | 500GB SSD / 750GB HDD | 17.3" | Win10 Pro
Desktop: 4690k | 12GB g.Skill RipJaws | GTX 970 | 520hx | Z87X-UD4H | Corsair Vengeance C70 | Corsair H110 | Acer 25" | Acer 22" | Win10
Mobile: Google Pixel XL


If I help you, or you just like what I said, rep me by clicking the under my post
carnageX is offline   Reply With Quote
Old 01-22-2014, 02:21 AM   #5 (permalink)
Newb Techie
 
Join Date: Jan 2014
Location: Australia
Posts: 19
Default Re: How to Shutdown/turnoff a laptop by plugging out its charger?

hmm thanks that'll do it. thanks guys!
__________________
JordanWhiteG is offline   Reply With Quote
Old 01-22-2014, 04:54 AM   #6 (permalink)
Newb Techie
 
Join Date: Jan 2014
Location: Australia
Posts: 19
Default Re: How to Shutdown/turnoff a laptop by plugging out its charger?

i'[m just having difficulties with writing the program i've never worked with C++ ! could you help me with that? i can do it in other languages and works perfectly but the thing is that the operating system we're using, won't support the program because it was written with an old language. If u could help me out with writing it on C++, that would be awesome or maybe give me some hints. thanks alot again for your time and your response.
__________________
JordanWhiteG is offline   Reply With Quote
Old 01-22-2014, 09:22 AM   #7 (permalink)
Private Joker
 
carnageX's Avatar
 
Join Date: Feb 2007
Location: South Dakota
Posts: 24,707
Default Re: How to Shutdown/turnoff a laptop by plugging out its charger?

Well what OS are you using? That's going to affect how you can do it, depending on the system libraries you can use.
__________________
Laptop: MSI GT70 2OC-059us | i7-4700MQ | 16GB | GTX 770m | 500GB SSD / 750GB HDD | 17.3" | Win10 Pro
Desktop: 4690k | 12GB g.Skill RipJaws | GTX 970 | 520hx | Z87X-UD4H | Corsair Vengeance C70 | Corsair H110 | Acer 25" | Acer 22" | Win10
Mobile: Google Pixel XL


If I help you, or you just like what I said, rep me by clicking the under my post
carnageX is offline   Reply With Quote
Old 01-23-2014, 01:46 AM   #8 (permalink)
Newb Techie
 
Join Date: Jan 2014
Location: Australia
Posts: 19
Default Re: How to Shutdown/turnoff a laptop by plugging out its charger?

Yep and i'm using an ipad!
But i might use a small PC for my work SO @SLacker your method is very good but when i plug out the charger it shutsdown and it works but when the charger is plugged out, and when i turn it on, it stays on and it doesn't shutdown.so i don't want my laptop to turn on while the charger is plugged out OR when i turn it on and the charger is plugged out, the pc would automaticlly shutdown.
Do you you know how to do this?
__________________
JordanWhiteG is offline   Reply With Quote
Old 01-23-2014, 09:09 AM   #9 (permalink)
Private Joker
 
carnageX's Avatar
 
Join Date: Feb 2007
Location: South Dakota
Posts: 24,707
Default Re: How to Shutdown/turnoff a laptop by plugging out its charger?

You never answered my question as to what Operating System you're running on the laptop.

And I already suggested how to possibly do it - make a service/script that detects when the Power State flag switches from AC (plugged in) to battery power. Then you can just invoke the shutdown command with like a 30 second timer in case you want to cancel it.

Some ideas here: Schedule a task when PC switches from charging to AC power [Windows]
Talks about PowerShell and C++.
__________________
Laptop: MSI GT70 2OC-059us | i7-4700MQ | 16GB | GTX 770m | 500GB SSD / 750GB HDD | 17.3" | Win10 Pro
Desktop: 4690k | 12GB g.Skill RipJaws | GTX 970 | 520hx | Z87X-UD4H | Corsair Vengeance C70 | Corsair H110 | Acer 25" | Acer 22" | Win10
Mobile: Google Pixel XL


If I help you, or you just like what I said, rep me by clicking the under my post
carnageX is offline   Reply With Quote
Old 01-23-2014, 10:07 AM   #10 (permalink)
Slacking Guru
 
Slacker's Avatar
 
Join Date: Jan 2012
Location: placetoplace
Posts: 307
Default Re: How to Shutdown/turnoff a laptop by plugging out its charger?

Quote:
Originally Posted by JordanWhiteG View Post
Yep and i'm using an ipad!
But i might use a small PC for my work SO @SLacker your method is very good but when i plug out the charger it shutsdown and it works but when the charger is plugged out, and when i turn it on, it stays on and it doesn't shutdown.so i don't want my laptop to turn on while the charger is plugged out OR when i turn it on and the charger is plugged out, the pc would automaticlly shutdown.
Do you you know how to do this?
You can tweak the battery power controls and see if that gives you the control you desire.. I don't think it will. So that leaves you two options.
1.)Search for a software that will allow you this control.
or
2.) Take the advice of Carnage and write a script.

I am sure he will help ya out if you provide him some more info. Without answering what OS you are running the best answer to your question is.... write a script.
__________________

__________________
Alt + Delete + Control = problem solved
"Thinking is easy, acting is difficult, and to put one's thoughts into action is the most difficult thing in the world."
Johann Wolfgang von Goethe




Slacker is offline   Reply With Quote
Reply

Tags
informationtechnology, laptop

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 04:03 AM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.