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.

Prevent Monitor turning Off when Audio is playing?

If you have a question or need help, this is the place to be.
Post Reply
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Prevent Monitor turning Off when Audio is playing?

Post by blaher »

Is there a way to prevent the monitor turning off when a program is playing music? I want my monitor to turn off after a while, but if I'm playing music, normally through Winamp, the monitor going to sleep stops the music because it's an HDMI connection to a receiver which Win 7 treats as a 2nd monitor.

Cheers.
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: Prevent Monitor turning Off when Audio is playing?

Post by blaher »

I managed to do it with a couple of macros for when winamp starts/stops & "rundll32.exe Shell32.dll,Control_RunDLL powercfg.cpl" with keyboard presses. I've posted it below in case it helps someone.

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1568" Guid="{CF00F1A5-AB6D-4229-BFB4-BF2E5D942325}" Time="1337054027.42">
<Autostart Name="Autostart" Expanded="True">
<Plugin Identifier="Task" Guid="{D1748551-C605-4423-B392-FB77E6842437}" File="Task">
gAIpLg==
</Plugin>
</Autostart>
<Macro Name="Disable Monitor Sleeping on Winamp Starting" Expanded="True">
<Event Name="Task.Created.winamp" />
<Action>
System.Execute(u'rundll32.exe', u'Shell32.dll,Control_RunDLL powercfg.cpl', 0, False, 2, u'', False)
</Action>
<Action>
Window.FindWindow(u'explorer.exe', u'Power Options', u'CabinetWClass', u'', u'DirectUIHWND', 3, False, 1.0, 0)
</Action>
<Action>
Window.BringToFront()
</Action>
<Action>
Window.SendKeys(u'{Down}', False)
</Action>
<Action>
Window.SendKeys(u'{Down}', False)
</Action>
<Action>
Window.SendKeys(u'{Down}', False)
</Action>
<Action>
Window.SendKeys(u'{Down}', False)
</Action>
<Action>
Window.SendKeys(u'{Enter}', False)
</Action>
<Action>
Window.FindWindow(u'explorer.exe', u'Edit Plan Settings', u'CabinetWClass', u'', u'ComboBox', 1, False, 1.0, 0)
</Action>
<Action>
Window.SendKeys(u'{N}', False)
</Action>
<Action>
Window.FindWindow(u'explorer.exe', u'Edit Plan Settings', u'CabinetWClass', u'Save changes', u'Button', 1, False, 1.0, 0)
</Action>
<Action>
Window.SendMessage(245, 0, 0, 0)
</Action>
<Action>
Window.FindWindow(u'explorer.exe', u'Power Options', u'CabinetWClass', u'', u'DirectUIHWND', 3, False, 1.0, 0)
</Action>
<Action>
Window.Close()
</Action>
</Macro>
<Macro Name="Enable Monitor Sleeping on Winamp Closing" Expanded="True">
<Event Name="Task.Destroyed.winamp" />
<Action>
System.Execute(u'rundll32.exe', u'Shell32.dll,Control_RunDLL powercfg.cpl', 0, False, 2, u'', False)
</Action>
<Action>
Window.FindWindow(u'explorer.exe', u'Power Options', u'CabinetWClass', u'', u'DirectUIHWND', 3, False, 1.0, 0)
</Action>
<Action>
Window.BringToFront()
</Action>
<Action>
Window.SendKeys(u'{Down}', False)
</Action>
<Action>
Window.SendKeys(u'{Down}', False)
</Action>
<Action>
Window.SendKeys(u'{Down}', False)
</Action>
<Action>
Window.SendKeys(u'{Down}', False)
</Action>
<Action>
Window.SendKeys(u'{Enter}', False)
</Action>
<Action>
Window.FindWindow(u'explorer.exe', u'Edit Plan Settings', u'CabinetWClass', u'', u'ComboBox', 1, False, 1.0, 0)
</Action>
<Action>
Window.SendKeys(u'{1}', False)
</Action>
<Action>
Window.SendKeys(u'{1}', False)
</Action>
<Action>
Window.FindWindow(u'explorer.exe', u'Edit Plan Settings', u'CabinetWClass', u'Save changes', u'Button', 1, False, 1.0, 0)
</Action>
<Action>
Window.SendMessage(245, 0, 0, 0)
</Action>
<Action>
Window.FindWindow(u'explorer.exe', u'Power Options', u'CabinetWClass', u'', u'DirectUIHWND', 3, False, 1.0, 0)
</Action>
<Action>
Window.Close()
</Action>
</Macro>
</EventGhost>
User avatar
wakko
Posts: 33
Joined: Sat Aug 20, 2011 9:27 pm
Location: Russia, Siberia

Re: Prevent Monitor turning Off when Audio is playing?

Post by wakko »

I think, there is yet another one solution. (In theory) :-)
Run together with winamp a timer (it can be plugin timer).
You can trigger some unique-named event with timer, say, every 1 minute, and that event will hire macros with keyboard emulation plugin, imitating right shift press, for example.
That will prevent your monitor from sleeping.
And, together with winamp, also stop that timer.
Post Reply