I love EventGhost! At last I have a way to switch the TV and amplifier on/off automatically along with my Windows 7 Media Center PC using the Microsoft remote control. I've made an EventGhost event to send serial commands to the amp & TV to switch them on when the PC resumes from standby, and this works 100% reliably. The only problem is that when the PC wakes up automatically to record something from TV, the amp and TV turn on too!
Is there any way that I can get EG to be able to tell the difference between the PC resuming from standby because I pressed "PC on" button on the Microsoft remote control, and the PC resuming from standby because Windows decided that it needed to wake up to record a program? It would be fantastic to get a solution to this. Has anyone else been in a similar situation?
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.
Detecting automatic resume from standby vs manual
-
Banana Jack
- Posts: 1
- Joined: Sun Mar 20, 2011 4:49 pm
Re: Detecting automatic resume from standby vs manual
This should work for you, I had to use powercfg back in the day to figure out a sleep issue. I think powercfg needs admin access to run so you might have to fiddle with it a bit, maybe have EG run under the admin account.
You'll only need to run this once after your computer wakes to record a show, it'll make sure EG can run the command and get the wake up info you'll need, it will create a file c:\temp.txt.
Stick this in the macro before your TV and amp commands. You'll need to replace 'Device Name' with something unique from temp.txt such as the device's description. If that device has woken the computer the macro will stop running.
Assuming your computer always sleeps after recording and you'll never need to run this macro while it's recording this should work without a hitch.
You'll only need to run this once after your computer wakes to record a show, it'll make sure EG can run the command and get the wake up info you'll need, it will create a file c:\temp.txt.
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1486">
<Action>
EventGhost.PythonScript(u"import os\n\nprint os.popen('powercfg -lastwake > c:\\\\temp.txt').read()")
</Action>
</EventGhost>
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1486">
<Action Name="Wake Check Script">
EventGhost.PythonScript(u"import os\n\nif 'Device Name' in os.popen('powercfg -lastwake').read():\n eg.StopMacro()")
</Action>
</EventGhost>
Re: Detecting automatic resume from standby vs manual
I need that too for the exact same reasons.
Girder was doing it with V4 but V5 screwed it. That why I'm looking for an alternative. Windows 7 x64 please...
Is it possible to add it into the power management event?
Charles
Girder was doing it with V4 but V5 screwed it. That why I'm looking for an alternative. Windows 7 x64 please...
Is it possible to add it into the power management event?
Charles
Re: Detecting automatic resume from standby vs manual
I realize it's been over a year since the last post to this thread.
I'm having a hard time running this script. EventGhost shows this when trying to run the script as described.
Python Script
Python Script
Error compiling script.
Traceback (most recent call last):
SyntaxError: invalid syntax (5, line 1)
Obviously I'm a script newb but hoping someone here can help me out since this seems to be the one fool proof way of detecting whether the resume is automatic or manual.
Win 7 x64 with an admin account and UAC turned off. I doubt that this matters but the system is resuming out of S3. Also I don't know if this could affect anything but the User folders (including the appdata path) are on a seperate drive.
Brian
I'm having a hard time running this script. EventGhost shows this when trying to run the script as described.
Python Script
Python Script
Error compiling script.
Traceback (most recent call last):
SyntaxError: invalid syntax (5, line 1)
Obviously I'm a script newb but hoping someone here can help me out since this seems to be the one fool proof way of detecting whether the resume is automatic or manual.
Win 7 x64 with an admin account and UAC turned off. I doubt that this matters but the system is resuming out of S3. Also I don't know if this could affect anything but the User folders (including the appdata path) are on a seperate drive.
Brian
Re: Detecting automatic resume from standby vs manual
I have a script to do the same thing just not as fancy. Use these macros together with the command file attached (which you should copy to C:\Program Files (x86)\EventGhost\scripts)...
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1544">
<Macro Name="Wake Up">
<Event Name="System.Resume" />
<Action>
System.Execute(u'C:\\Program Files (x86)\\EventGhost\\scripts\\ScheduledWakeCheck.cmd', u'', 3, True, 2, u'C:\\Program Files (x86)\\EventGhost\\scripts')
</Action>
<Action>
FileOperations.Read(0, u'C:\\Program Files (x86)\\EventGhost\\scripts\\ScheduledWakeCheck.txt', 0, 0, 'cp1252', 1, False, 1)
</Action>
<Action>
EventGhost.PythonScript(u'if eg.result == "1":\n eg.StopMacro()')
</Action>
<Action>
EventGhost.NewJumpIf(XmlIdLink(85), 2, True)
</Action>
</Macro>
<Macro Name="Unscheduled Wakeup" id="85">
</Macro>
</EventGhost>- Attachments
-
- ScheduledWakeCheck.zip
- Unzip deploy to program files\eventghost\scripts
- (334 Bytes) Downloaded 359 times
Re: Detecting automatic resume from standby vs manual
Perfect! I can't wait to try it later tonight. Thank you Buddha. I'll let you know if I have questions about it later but it seems straight forward.
Re: Detecting automatic resume from standby vs manual
Sorry to bring up an old thread but I did not see this posted anywhere. I am a relatively new Eventghost user and use the RCAware device. I would like eventghost to recognize when the device is woken up automatically for a recording or when I manually wake it up with my remote to activate the eventghost hdmi cec command to turn on my tv. The script above seems to do exactly what I would like but unfortunately I am returned with a bunch of syntax errors every time I try to insert the script.
Traceback (most recent call last) (1610):
File "C:\Program Files (x86)\EventGhost\eg\Classes\MainFrame\__init__.py", line 345, in FuncWrapper
func()
File "C:\Program Files (x86)\EventGhost\eg\Classes\MainFrame\__init__.py", line 869, in OnCmdPaste
self.DispatchCommand("OnCmdPaste")
File "C:\Program Files (x86)\EventGhost\eg\Classes\MainFrame\__init__.py", line 813, in DispatchCommand
getattr(self.document, command[2:])()
File "C:\Program Files (x86)\EventGhost\eg\Classes\Document.py", line 519, in CmdPaste
eg.UndoHandler.Paste(self).Do(self.selection)
File "C:\Program Files (x86)\EventGhost\eg\Classes\UndoHandler\Paste.py", line 47, in Do
dataObj.GetText()
File "C:\Program Files (x86)\EventGhost\eg\Classes\ThreadWorker.py", line 62, in __call__
self.returnValue = self.func(*self.args, **self.kwargs)
File "C:\Program Files (x86)\EventGhost\eg\Classes\UndoHandler\Paste.py", line 109, in PasteXml
newNode = childCls(selection, childXmlNode)
File "C:\Program Files (x86)\EventGhost\eg\Classes\ContainerItem.py", line 38, in __init__
for childNode in node
File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionItem.py", line 69, in __init__
plugin = getattr(eg.plugins, pluginStr).plugin
AttributeError: 'Bunch' object has no attribute 'FileOperations'
Thank you for any help! I would love to get this working
Traceback (most recent call last) (1610):
File "C:\Program Files (x86)\EventGhost\eg\Classes\MainFrame\__init__.py", line 345, in FuncWrapper
func()
File "C:\Program Files (x86)\EventGhost\eg\Classes\MainFrame\__init__.py", line 869, in OnCmdPaste
self.DispatchCommand("OnCmdPaste")
File "C:\Program Files (x86)\EventGhost\eg\Classes\MainFrame\__init__.py", line 813, in DispatchCommand
getattr(self.document, command[2:])()
File "C:\Program Files (x86)\EventGhost\eg\Classes\Document.py", line 519, in CmdPaste
eg.UndoHandler.Paste(self).Do(self.selection)
File "C:\Program Files (x86)\EventGhost\eg\Classes\UndoHandler\Paste.py", line 47, in Do
dataObj.GetText()
File "C:\Program Files (x86)\EventGhost\eg\Classes\ThreadWorker.py", line 62, in __call__
self.returnValue = self.func(*self.args, **self.kwargs)
File "C:\Program Files (x86)\EventGhost\eg\Classes\UndoHandler\Paste.py", line 109, in PasteXml
newNode = childCls(selection, childXmlNode)
File "C:\Program Files (x86)\EventGhost\eg\Classes\ContainerItem.py", line 38, in __init__
for childNode in node
File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionItem.py", line 69, in __init__
plugin = getattr(eg.plugins, pluginStr).plugin
AttributeError: 'Bunch' object has no attribute 'FileOperations'
Thank you for any help! I would love to get this working
Re: Detecting automatic resume from standby vs manual
Any help on this? It's become an even bigger issue now. To make my Logitech Revue k700 media keyboard be able to turn on the tv through hdmi cec I had to set my tv to allow hdmi devices to control power. What this then does is, when the pc wakes up from sleep, it turns on the display. The problem with that is if the computer is just waking up to record then the display goes on and will no go off. I need eventghost to recognize if the pc woke up from user activity or not so I can have it send a power command to the tv to turn back off after wakeup.
-
barnabas1969
- Experienced User
- Posts: 133
- Joined: Sat Feb 04, 2012 1:42 am
Re: Detecting automatic resume from standby vs manual
Hi wex101.
Sorry I didn't notice this post earlier. For a long time, I was using a batch script that used "powercfg -lastwake" plus the "find" command to determine if the PC woke due to user input (checking to see if it woke due to a USB device, which would indicate that it woke from the keyboard, mouse, or IR remote control).
On my system, the powercfg program sometimes hangs. You may not have this same problem. However, I found a cool workaround. I used the Windows Task Scheduler to trigger an event in Event Ghost when the PC wakes due to user input.
See my post describing the configuration at the link below:
http://www.thegreenbutton.tv/forums/vie ... ilit=event
Sorry I didn't notice this post earlier. For a long time, I was using a batch script that used "powercfg -lastwake" plus the "find" command to determine if the PC woke due to user input (checking to see if it woke due to a USB device, which would indicate that it woke from the keyboard, mouse, or IR remote control).
On my system, the powercfg program sometimes hangs. You may not have this same problem. However, I found a cool workaround. I used the Windows Task Scheduler to trigger an event in Event Ghost when the PC wakes due to user input.
See my post describing the configuration at the link below:
http://www.thegreenbutton.tv/forums/vie ... ilit=event