Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Screensaver Event?
Screensaver Event?
Hello,
I am trying to turn off my TV when the screensaver is activated and turn on the TV when the screensaver is deactivated.
I have the TV on/off functions working, but I can't find the event for the screensaver. What can I use to accomplish this?
Thank you,
Ryan
I am trying to turn off my TV when the screensaver is activated and turn on the TV when the screensaver is deactivated.
I have the TV on/off functions working, but I can't find the event for the screensaver. What can I use to accomplish this?
Thank you,
Ryan
Re: Screensaver Event?
The "Task Create/Switch Events" plugin generates several events on my WinXP when the screensaver is activated.spazlon wrote:I have the TV on/off functions working, but I can't find the event for the screensaver. What can I use to accomplish this?
jonib
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Screensaver Event?
If you are using still the same screen saver, you can use for your purpose the Application Observer plugin.
I just added there to observe not only the application type .exe, but also type .scr.
For example, the 3D Text screensaver you simply add to observe by adding the ssText3d.scr applications.
If you change screensaver sometimes, it's better to use this script:The script should be placed into a macro that will be triggered after start by event Main.OnInit.Pako
I just added there to observe not only the application type .exe, but also type .scr.
For example, the 3D Text screensaver you simply add to observe by adding the ssText3d.scr applications.
If you change screensaver sometimes, it's better to use this script:
Code: Select all
period = 2.0 #Test every 2 seconds
SPI_GETSCREENSAVERRUNNING = 0x72
from ctypes import byref, c_bool
from ctypes.wintypes import WinDLL
saverRunning = c_bool()
def CheckScreensaverRunning():
WinDLL("user32").SystemParametersInfoA(SPI_GETSCREENSAVERRUNNING, 0, byref(saverRunning), False)
running = saverRunning.value
if running != eg.globals.ScreenSaverRunning:
eg.globals.ScreenSaverRunning = running
eg.TriggerEvent("ScreensaverRunning.%s" % str(running), prefix="System")
eg.scheduler.AddTask(period, CheckScreensaverRunning)
eg.globals.ScreenSaverRunning = None
CheckScreensaverRunning()Re: Screensaver Event?
This didn't work for me because when the screensaver was activated the dekstop event would fire. This means if the screensaver came on, the TV would turn off, but also if I minimized MCE the TV would also turn off.jonib wrote:The "Task Create/Switch Events" plugin generates several events on my WinXP when the screensaver is activated.
I will give this a try when I get home tonight. This looks like a solid solution. I see how it will fire an event when the screensaver is activated, but when the screensaver is deactivated will it fire another event?Pako wrote:Code: Select all
period = 2.0 #Test every 2 seconds SPI_GETSCREENSAVERRUNNING = 0x72 from ctypes import byref, c_bool from ctypes.wintypes import WinDLL saverRunning = c_bool() def CheckScreensaverRunning(): WinDLL("user32").SystemParametersInfoA(SPI_GETSCREENSAVERRUNNING, 0, byref(saverRunning), False) running = saverRunning.value if running != eg.globals.ScreenSaverRunning: eg.globals.ScreenSaverRunning = running eg.TriggerEvent("ScreensaverRunning.%s" % str(running), prefix="System") eg.scheduler.AddTask(period, CheckScreensaverRunning) eg.globals.ScreenSaverRunning = None CheckScreensaverRunning()
Thanks for the quick replies guys!!
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Screensaver Event?
Of course yes.spazlon wrote: I see how it will fire an event when the screensaver is activated, but when the screensaver is deactivated will it fire another event?
Code: Select all
System.ScreensaverRunning.True
System.ScreensaverRunning.FalseRe: Screensaver Event?
I got these events when the screensaver activated Task.Created.scrnsave, Task.NewWindow.scrnsave and Task.Activated.scrnsave.spazlon wrote:This didn't work for me because when the screensaver was activated the dekstop event would fire. This means if the screensaver came on, the TV would turn off, but also if I minimized MCE the TV would also turn off.
And when the screensaver deactivated I got these events Task.Deactivated.scrnsave, Task.ClosedWindow.scrnsave and Task.Destroyed.scrnsave.
Don't you get those?
jonib
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Screensaver Event?
I get only this (timeout = 1 min; OS = Windows 7):Pako
Code: Select all
13:49:36 System.Idle
13:49:57 Task.Deactivated.pn
13:49:57 Task.Activated.Desktop
13:52:02 System.UnIdle
13:52:02 Task.Deactivated.Desktop
13:52:02 Task.Activated.pnRe: Screensaver Event?
Nope, I'm at work right now so I can't get the logs, but it was something like Application.Desktop when the screensaver was activated and Application.MediaCenter when the screensaver was deactivated.jonib wrote:I got these events when the screensaver activated Task.Created.scrnsave, Task.NewWindow.scrnsave and Task.Activated.scrnsave.spazlon wrote:This didn't work for me because when the screensaver was activated the dekstop event would fire. This means if the screensaver came on, the TV would turn off, but also if I minimized MCE the TV would also turn off.
And when the screensaver deactivated I got these events Task.Deactivated.scrnsave, Task.ClosedWindow.scrnsave and Task.Destroyed.scrnsave.
Don't you get those?
jonib
I will play with it some more tonight when I get home.
Re: Screensaver Event?
Pako wrote:I get only this (timeout = 1 min; OS = Windows 7):PakoCode: Select all
13:49:36 System.Idle 13:49:57 Task.Deactivated.pn 13:49:57 Task.Activated.Desktop 13:52:02 System.UnIdle 13:52:02 Task.Deactivated.Desktop 13:52:02 Task.Activated.pn
Bah, you posted when I was composing that last post.
I'm pretty sure those are the same log events I get as well.
Pako, I will try your method tonight.
Thanks again guys!
Re: Screensaver Event?
Pako -
This ended up working perfectly. Thanks!
Now I just need to see if it will work while I am in Media Center. I don't remember the name of the screensaver it runs.
Thanks again!
This ended up working perfectly. Thanks!
Now I just need to see if it will work while I am in Media Center. I don't remember the name of the screensaver it runs.
Thanks again!
