Page 1 of 3
EventGhost Application Control Plugin
Posted: Fri Jun 15, 2012 8:32 pm
by phlox
Hi guys
I wrote a small plugin which allows to access and control EventGhost application functions from macros like 'Restart Program', 'Save Configuration', 'Minimize Window' etc.
New in version 0.3.2: Log file monitoring and parsing. The new action 'Log Monitor' monitors the screen log and fires an event if a specific message occurs. Optionally, the log message can be parsed in several ways and the extracted values found can be used as event payload or a variable can be set.
Handy for example if you want to react in some way when an unexpected error occurs or in another scenario when you want to extract a value from the log stream and fire an event when it occurs.
It's easy to add additional functions, just let me know if you miss something.
have fun
Re: EventGhost Application Control Plugin
Posted: Wed Jun 20, 2012 3:26 am
by kalia
phlox,
First, thanks for sharing.
I justed wanted to point out that I get several errors using the Hide/Restore the Main Window actions. I can post the errors if you like, but it is no big deal for me. The errors happen if you restore the window and try to click on any action in EventGhost tree.
Regarding additional functions, I alway like to backup my xml file when changes are made. I use the following Python script:
Code: Select all
import time
from datetime import date
if eg.document.isDirty:
eg.document.Save()
print "File needs to be saved"
today = date.today()
FilePath = "D:\\Software\\EventGhost\\XML Backups\\"+str(today)+".xml"
eg.document.WriteFile(FilePath)
eg.Wait(2)
Again, thanks for sharing.
Re: EventGhost Application Control Plugin
Posted: Mon Jun 25, 2012 8:38 pm
by phlox
first of all, sorry for the late reply, I simply overlooked it.
I can't reproduce these errors here, could you post your config and the error log? Thx in advance, I'll look at it.
regarding the additional function: I think it's a good idea to add some 'IsDirty' action, but the rest of your script is probably too specific to pack it into a generic action - I guess your solution is best you can do for this requirement.
Re: EventGhost Application Control Plugin
Posted: Mon Jun 25, 2012 10:56 pm
by Livin
phlox
While I don't need this for EG itself, I still wanted to thank you for sharing!
Re: EventGhost Application Control Plugin
Posted: Tue Jul 24, 2012 4:46 pm
by phlox
Here's a minor update:
EventGhost Application Control 0.1.1 (download in the first post)
Changes
Regarding the problem reported by @kalia: I can't reproduce. As long as nobody else confirms, I assume it was a mistake / had another cause.
Re: EventGhost Application Control Plugin
Posted: Sat Jul 28, 2012 4:29 am
by kalia
phlox,
Don't bother about the errors I mentioned. It was probably something with my config. I don't have the plugin installed in my current config (I use scripts instead to accomplish the plugin actions). That is why I have not posted the errors.
Thanks,
kalia
Re: EventGhost Application Control Plugin
Posted: Mon Nov 05, 2012 5:32 am
by blaher
Thank you for this. It's handy to be able to restart EventGhost on command. It would be even handier if errors and information messages could be used as triggers. That way if something goes wrong EG could be restarted automatically.
Re: EventGhost Application Control Plugin
Posted: Wed Nov 07, 2012 12:26 pm
by phlox
Think that's a good idea. I could implement an action which monitors a configurable info or error message and then triggers a configurable event. I'll do that in the near future, as soon as I find some time to code again.
Re: EventGhost Application Control Plugin
Posted: Sat Nov 10, 2012 9:48 pm
by piipes
phlox wrote:Think that's a good idea. I could implement an action which monitors a configurable info or error message and then triggers a configurable event. I'll do that in the near future, as soon as I find some time to code again.
I need that function too. If some program hangs, eventgost will hang also and i have to use my keyboard. So nice, if you can "fix" that one and only eventghost weak point.
Re: EventGhost Application Control Plugin
Posted: Sun Nov 11, 2012 5:50 pm
by phlox
I'm almost done - unfortunately the rainy Sunday was a bit too short to finalized - I need some more time
Here's a preview of the new action:
(obsolete attachment removed, see
here for an example)
Re: EventGhost Application Control Plugin
Posted: Mon Nov 12, 2012 1:06 pm
by Pako
It looks good.
While I have no use for it at the moment, but you never know.
I just want to ask, it will be compatible with
Log redirector plugin?
Pako
Re: EventGhost Application Control Plugin
Posted: Mon Nov 12, 2012 8:02 pm
by phlox
Hi Pako
yes, of course. The implementation is fully transparent for the rest of EG. It's actually very simple, the action has a wrapper to the existing LogCtrl API (called by 'eg.log.SetCtrl(f)').
btw, I'm using Log Redirector by myself, it's very handy.
Code: Select all
class LogWrapper:
def __init__(self):
self.egLogCtrl = eg.log.ctrl
self.logListener = []
def AddLogListener(self, listener):
if len(self.logListener) == 0:
eg.log.SetCtrl(self)
if listener not in self.logListener:
self.logListener.append(listener)
def StopAllLogListeners(self):
eg.log.SetCtrl(self.egLogCtrl)
self.logListener = []
# implements the LogCtrl API
def WriteLine(self, line, icon, wRef, when, indent):
self.egLogCtrl.WriteLine(line, icon, wRef, when, indent)
for listener in self.logListener:
listener.ProcessMsg(line, icon)
Re: EventGhost Application Control Plugin
Posted: Tue Nov 13, 2012 6:25 am
by Pako
Great.
I was just worried that there might be some conflict and something might stop working.
But it is obvious that you (unlike me) a real programmer.
BTW - I've never heard of Python until I met EventGhost. And everything I've done in Python, concerns EventGhost.
I've previously programmed only single-chip microcomputers (as a hobby) and it was in assembler.
Pako
Re: EventGhost Application Control Plugin
Posted: Wed Nov 14, 2012 3:47 am
by blaher
phlox wrote:I'm almost done - unfortunately the rainy Sunday was a bit too short to finalized - I need some more time
Here's a preview of the new action:
It looks great. I look forward to trying it.

Re: EventGhost Application Control Plugin
Posted: Wed Nov 14, 2012 5:14 pm
by phlox
Pako wrote:Great.
But it is obvious that you (unlike me) a real programmer.
Thanks - but I have to admit that my Python knowledge is also very young and my Python horizon ends at the borders of EventGhost (but I have a Java background and the language concepts are quite similar). Many things I learned in Python was by reading Your code, Pako, my full respect!