ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Laptop Battery.

<< < (2/2)

Vurbal:
Isn't there usually an icon down in the system tray that shows whether you are on AC or battery?
-Innuendo (January 04, 2014, 12:09 PM)
--- End quote ---

It doesnt notify of the change though (power => battery).
-tomos (January 04, 2014, 02:33 PM)
--- End quote ---

The icon always changed on my old WinXP laptops.

tomos:
^ yeah, sorry, I wasnt clear there: I meant no notification in a more in your face manner, e.g. popup. Taskbar on autohide here doesnt help either, but I dont know how the OP (who's looking for this) works, so that may be the solution.

4wd:
Knowing what OS the OP is talking about would go a long way towards suggesting anything.

jrmelb:
Yes - the OS is Windows 7.

 :)

4wd:
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.


--- Code: AutoIt ---#Region ;**** Directives created by AutoIt3Wrapper_GUI ****#AutoIt3Wrapper_UseUpx=n#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;--- Tray Menu ---Opt('TrayMenuMode', 3)TraySetClick(16)$exititem = TrayCreateItem('Exit')  ; WMI object creation for CIMV2 namespace$gobjWMI_CIMV2 = ObjGet("winmgmts:\\.\root\cimv2") ; WMI event notification sink for power management$gobjWMI_PowerEVT_Sink = ObjCreate("WbemScripting.SWbemSink")ObjEvent($gobjWMI_PowerEVT_Sink, "PowerEVT_SINK_")  ; 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        $nMsg = TrayGetMsg()        Switch $nMsg                Case $exititem                        Exit                Case Else        EndSwitch        Sleep(100)WEnd ; Power Management event sink functionFunc PowerEVT_SINK_OnObjectReady($wmiObject, $wmiAsyncContext)        $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                        MsgBox(48, "YTOTPC", "Excuse me but you have suffered a AC/DC event." & @CRLF & @CRLF & "This could be because you tripped over the power cord" & @CRLF & "or inadvertently plugged it in.")                Case 11                        ; OEM Power event...                Case 18                        ; Hardware triggered resume from suspend...                Case Else                        ; You can case these out from the constant defines mentioned earlier in this thread        EndSwitchEndFunc   ;==>PowerEVT_SINK_OnObjectReady




* You Tripped Over The Power Cord

Navigation

[0] Message Index

[*] Previous page

Go to full version