Jump to content

Detecting power states...possible?


Recommended Posts

  • Developers

Guess you mean a UPS?

Why would a computer know about this at all since the power is always running through a UPS and it is only the "other side" of the UPS that uses another source to draw its power from.

Most UPSes are able to communicate through a network connection to signal a program running on a server/computer about the fact it is running of batteries.

_WinAPI_GetSystemPowerStatus ?

Think this is for the status of a Laptop giving the status whether it is running on mains or it's internal battery and giving its status.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Yes, UPS I meant.  Is there anyway to read the % of batteries left in the UPS?  I have a situation where computers become unplugged and then eventually die on UPS leaving me with all kinds of software problems to fix.  Goal was to send out a msg to a pager when Autoit script detects PC is running on UPS.

Link to comment
Share on other sites

Is this a stand alone computer or a server? If it's one computer connected to one UPS, most UPSs come with software that will tell the computer that it's on battery power and that software can shut the computer down. As long as the UPS is connected to the computer, usually by USB/Serial cable, and you have a modern UPS it should work. 

PowerChute is what APC uses for their monitoring software.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

The computer has no physical connection to the UPS unless you connect it to the computer so it can't even know that it has a UPS connected. If you do have it connected, there are ways to detect that it's running on batteries.

This might be of some help, and I believe that there's ways to monitor the HID UPS Battery device if you don't have any other software installed.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...