Sidebar

reference:scripting_reference:scripting_objects:powereventdata

A script add-in can implement the OnPowerEvent method to receive notifications of certain system power-related events. The PowerEventData object is passed as the single argument to this method.

Property Name Return Type Description

data

string

Returns data for this event. The meaning of this property varies depending on the value of the type property.

type

string

Returns the power event type. Possible events are:

batteryThe remaining battery capacity has changed. The current battery capacity is provided in the data property.
displayThe display state has changed. The data property will equal "on", "dimmed" or "off".
resumeThe system has resumed from sleep or hibernation.
saverBattery saver mode state has changed. The data property will equal "on" or "off".
sourceThe power source has changed. The data property will equal "battery", "ups" or "ac".
suspendThe system is about to enter sleep or hibernation.