Executing stuff on shutdown, plus standby stuff.

If you have a question or need help, this is the place to be.
User avatar
kgschlosser
Site Admin
Posts: 4424
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Executing stuff on shutdown, plus standby stuff.

Post by kgschlosser » Sun May 14, 2017 10:34 pm

and here is a bunch more events for power related things

System.Monitor.Off
System.Monitor.On
System.Monitor.Dim

System.PowerSource.Line
System.PowerSource.Battery
System.PowerSource.UPS

System.BatteryLevel.0%
thru
System.BatteryLevel.100%


System.PowerSaving.Off
System.PowerSaving.On

System.PowerProfile.PowerSaver
System.PowerProfile.HighPerformance
System.PowerProfile.Balanced

windows xp only
System.BatteryLevel.Low
System.OemEvent
System.QuerySuspendFailed
System.ResumeCritical
System.QuerySuspend
If you like the work I have been doing then feel free to Image

nYce
Posts: 41
Joined: Wed Mar 28, 2018 2:29 am

Re: Executing stuff on shutdown, plus standby stuff.

Post by nYce » Thu Aug 30, 2018 8:17 pm

And how can i delay the shutdown now?

I want to do some stuff (like powering down the projector (CEC+), send a message to my smartphone (Autoremote)), but it seems that doesnt delay the shutdown.

Probably i can open an unsaved document and kill it after i got all my stuff done?

The wait doesnt seem to delay the shutdown in any way..

User avatar
kgschlosser
Site Admin
Posts: 4424
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Executing stuff on shutdown, plus standby stuff.

Post by kgschlosser » Fri Aug 31, 2018 3:00 pm

I am thinking this is going to give you a solution.

backup the file c:\program files (x86)\eventghost\plugins\system\__init__.py
download the 2 attached files and put them into c:\program files (x86)\eventghost\plugins\system
overwrite the __init__.py file

this will generate a couple new events

System.EndSession.SystemShutdown = Shutdown/Restart
System.EndSession.EventGhostShutdown = System is requesting the close of EventGhost
System.EndSession.LogOff = Local Logoff
System.EndSession.EventGhostForcedClose = System is forcing the close of EventGhost (out of memory.. things like that)


There are 2 new actions.

Shutdown\Block Shutdown
Shutdown\Block Logoff

They will do exactly as they state. with the Block Shutdown if you want to disable it run the same action with the message field blank.

This is going to stall the shutdown while the event System.EndSession.SystemShutdown is running. so any actions you are performing will get run before the shutdown occurs.

I have not fully tested this yet. but if someone wants to give it a go it should work.
Attachments
ShutdownNotifier.py
(3.17 KiB) Downloaded 18 times
__init__.py
(74.32 KiB) Downloaded 14 times
If you like the work I have been doing then feel free to Image

cvben
Posts: 38
Joined: Wed Jun 07, 2017 8:30 pm

Re: Executing stuff on shutdown, plus standby stuff.

Post by cvben » Fri Aug 31, 2018 10:15 pm

I'm not sure I've had an issue with a "wait" command not working, but as a temporary workaround you could have an event trigger the stuff you want to do before shutdown, then at the end of the event chain use the triggerevent function that actually shuts down. Thats what I always do to avoif any conflicts or oddity.

ex:

ir button press event::
do x
do y
do z
trigger "actual shutdown event" (the delay on trigger works for certain on my end)

then there would be a separate macro which listens for the "actual shutdown event"

User avatar
kgschlosser
Site Admin
Posts: 4424
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Executing stuff on shutdown, plus standby stuff.

Post by kgschlosser » Sat Sep 01, 2018 12:28 am

I am not sure But I do know that some remotes are hard coded for the shutdown through the driver it's self. and using EventGhost is not necessarly an option if you want to retain the use of that button.


Or if you use the mouse and shutdown the computer but still want EventGhost to perform a specific set of actions. that is where the above would come in useful.

Also if you didn't want the accidental shutdown of the computer. This can be used to block that shutdown process. At the present state of the additions it will display a screen telling you the reason why it cannot shutdown with the option to force terminate EventGhost. I can add an action that will simply stop windows from shutting down no matter what. if that is something that is wanted.
If you like the work I have been doing then feel free to Image

Post Reply