Bemme Posted January 8, 2024 Posted January 8, 2024 Hey there, I just recently started to get into AutoIT since it might be usefull for deployment purposes. Anyways. I found the function _WinAPI_GetSystemPowerStatus and in its description it states that it should return a code 8, when the system is charging. I copied the example code from the docs and gave it a try but it didnt seem to detect that my system is charging. Is there anything I should know here to use it properly? Thanks in advance 😀
Nine Posted January 8, 2024 Posted January 8, 2024 Works well on my latop Win10... Bemme 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
rsn Posted January 8, 2024 Posted January 8, 2024 The sample script works on my Win10 as well (10.0.19045.3803). The array shows "1" for my laptop's charge status since it's at 100%. Bemme 1
Nine Posted January 8, 2024 Posted January 8, 2024 Just noticed that AutoIt function misses one stat (SystemStatusFlag) from the Win32 function (new stat introduced in Win10). Made a new ticket in bug tracker. Bemme 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Bemme Posted January 9, 2024 Author Posted January 9, 2024 It seems to work for me now too. I just checked the windows documentation and it seems that the BatteryStatus has a status code 2, which is send back when the device runs directly using the energy from the powercable but isnt actually charging up the device. So that might have been why it hasnt said that my device would be charging. Quote BatteryStatus Unknown (2) The system has access to AC so no battery is being discharged. However, the battery is not necessarily charging. (https://learn.microsoft.com/en-US/windows/win32/cimwin32prov/win32-battery)
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