2601
General Software Discussion / Re: Laptop Battery.
« Last post by 4wd on January 04, 2014, 11:49 PM »YTOTPC* - Pretty boring, any time there's a power state change it'll pop up a message box. This could be connecting or disconnecting AC power.
* You Tripped Over The Power Cord
Code: AutoIt [Select]
- #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_UseUpx=n
- #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
- ;--- Tray Menu ---
- ; WMI object creation for CIMV2 namespace
- ; WMI event notification sink for power management
- ; Build notifier object for power management events
- $gobjWMI_CIMV2.ExecNotificationQueryAsync($gobjWMI_PowerEVT_Sink, "Select EventType from Win32_PowerManagementEvent")
- ;; Sleep forevAr - make sure to build a hotkey somewhere to allow you to terminate this process...
- While 1
- Switch $nMsg
- Case $exititem
- ; Power Management event sink function
- $intEvent = $wmiObject.EventType
- Switch $intEvent
- Case 4
- ; Machine is entering suspend")
- Case 7
- ; OS reports resume from suspend is complete")
- Case 10
- ; AC <-> DC switch
- Case 11
- ; OEM Power event...
- Case 18
- ; Hardware triggered resume from suspend...
- ; You can case these out from the constant defines mentioned earlier in this thread
- EndFunc ;==>PowerEVT_SINK_OnObjectReady
* You Tripped Over The Power Cord

Recent Posts





