gift8188 Posted October 19, 2008 Share Posted October 19, 2008 (edited) hello! how to know the notebook using battery? Thank you~~~ Edited May 11, 2009 by SmOke_N Changed spelling in title Link to comment Share on other sites More sharing options...
gift8188 Posted October 19, 2008 Author Share Posted October 19, 2008 notekook ? What's that ?oh,sorry,it made a mistake.it is notebook Link to comment Share on other sites More sharing options...
autoitter Posted October 19, 2008 Share Posted October 19, 2008 Something like this maybe? $structSystemPowerStatus = DllStructCreate("byte ACLineStatus; byte BatteryFlag; byte BatteryLifePercent; byte Reserved1; dword BatteryLifeTime; dword BatteryFullLifeTime") $ret = DllCall("kernel32.dll", "int", "GetSystemPowerStatus", "ptr", DllStructGetPtr($structSystemPowerStatus)) If @error Then Exit If $ret <> 0 Then $nOnBattery = DllStructGetData($structSystemPowerStatus, "ACLineStatus") $nBatteryLife = DllStructGetData($structSystemPowerStatus, "BatteryLifePercent") If $nOnBattery == 0 Then MsgBox(48, @ScriptName, "Running on battery. Percentage = " & $nBatteryLife) Else MsgBox(48, @ScriptName, "Running on AC-power") EndIf EndIf Link to comment Share on other sites More sharing options...
gift8188 Posted October 19, 2008 Author Share Posted October 19, 2008 Something like this maybe? $structSystemPowerStatus = DllStructCreate("byte ACLineStatus; byte BatteryFlag; byte BatteryLifePercent; byte Reserved1; dword BatteryLifeTime; dword BatteryFullLifeTime") $ret = DllCall("kernel32.dll", "int", "GetSystemPowerStatus", "ptr", DllStructGetPtr($structSystemPowerStatus)) If @error Then Exit If $ret <> 0 Then $nOnBattery = DllStructGetData($structSystemPowerStatus, "ACLineStatus") $nBatteryLife = DllStructGetData($structSystemPowerStatus, "BatteryLifePercent") If $nOnBattery == 0 Then MsgBox(48, @ScriptName, "Running on battery. Percentage = " & $nBatteryLife) Else MsgBox(48, @ScriptName, "Running on AC-power") EndIf EndIf thanks~~~ Link to comment Share on other sites More sharing options...
ondrajka Posted January 26, 2009 Share Posted January 26, 2009 I was also looking for a way to make a power meter. I didn't find anything on the forums but stumbled on this on my own. I'm posting this on the posts that were talking about power meters. This works on my Compaq running XP. It will import even it the window is hidden. I do have the icon set to always show in the taskbar. $power1 imports the words Batteries or AC Power and $power2 imports the battery life in percent. $power1 = ControlGetText("Power Meter", "", "Static6") $power2 = ControlGetText("Power Meter", "", "Static8") msgbox (0,"", $power1 & " " & $power2) Link to comment Share on other sites More sharing options...
tazlikesrobots Posted May 11, 2009 Share Posted May 11, 2009 Something like this maybe? $structSystemPowerStatus = DllStructCreate("byte ACLineStatus; byte BatteryFlag; byte BatteryLifePercent; byte Reserved1; dword BatteryLifeTime; dword BatteryFullLifeTime") $ret = DllCall("kernel32.dll", "int", "GetSystemPowerStatus", "ptr", DllStructGetPtr($structSystemPowerStatus)) If @error Then Exit If $ret <> 0 Then $nOnBattery = DllStructGetData($structSystemPowerStatus, "ACLineStatus") $nBatteryLife = DllStructGetData($structSystemPowerStatus, "BatteryLifePercent") If $nOnBattery == 0 Then MsgBox(48, @ScriptName, "Running on battery. Percentage = " & $nBatteryLife) Else MsgBox(48, @ScriptName, "Running on AC-power") EndIf EndIf Awsome! Just what I needed to complete my project! Thanks for posting this Link to comment Share on other sites More sharing options...
Yashied Posted May 11, 2009 Share Posted May 11, 2009 (edited) hello!how to know the notebook using battery?Thank you~~~See this and this. Edited May 11, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Programs4All Posted July 9, 2014 Share Posted July 9, 2014 I changed it a bit, to make it comfortable for German Users: $structSystemPowerStatus = DllStructCreate("byte ACLineStatus; byte BatteryFlag; byte BatteryLifePercent; byte Reserved1; dword BatteryLifeTime; dword BatteryFullLifeTime") $x = 0 $p = 100 While 1 $ret = DllCall("kernel32.dll", "int", "GetSystemPowerStatus", "ptr", DllStructGetPtr($structSystemPowerStatus)) $nOnBattery = DllStructGetData($structSystemPowerStatus, "ACLineStatus") $nBatteryLife = DllStructGetData($structSystemPowerStatus, "BatteryLifePercent") If $nBatteryLife < $p -5 Then MsgBox(48, "Batterie Status", "Der Akku ist nur noch zu "&$nBatteryLife&"% gefüllt!") $p = $nBatteryLife EndIf If $nOnBattery == 0 Then If $x = 1 Or $x = 0 Then MsgBox(48, "Nicht angeschlossen!", "Der Computer ist nicht angeschlossen, und läuft über den Akku. ("&$nBatteryLife&"%)") $x = 2 EndIf Else If $x = 2 Or $x = 0 Then MsgBox(48, "Angeschlossen!", "Der Computer ist angeschlossen. ("&$nBatteryLife&"%)") $x = 1 EndIf EndIf WEnd Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now