EventGhost Application Control Plugin

Questions and comments specific to a particular plugin should go here.

EventGhost Application Control Plugin

Postby phlox » Fri Jun 15, 2012 8:32 pm

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.

EGAppControlPlugin.png

It's easy to add additional functions, just let me know if you miss something.

have fun
Attachments
EGAppControl_0.3.2.zip
Log Monitor action requires EventGhost 0.4.1.r1610 or higher
(224.1 KiB) Downloaded 60 times
Last edited by phlox on Fri Jan 25, 2013 10:02 pm, edited 4 times in total.
phlox
Plugin Developer
 
Posts: 89
Joined: Wed Jan 11, 2012 3:49 pm

Re: EventGhost Application Control Plugin

Postby kalia » Wed Jun 20, 2012 3:26 am

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.
kalia
Experienced User
 
Posts: 64
Joined: Wed Aug 12, 2009 1:10 am

Re: EventGhost Application Control Plugin

Postby phlox » Mon Jun 25, 2012 8:38 pm

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.
phlox
Plugin Developer
 
Posts: 89
Joined: Wed Jan 11, 2012 3:49 pm

Re: EventGhost Application Control Plugin

Postby Livin » Mon Jun 25, 2012 10:56 pm

phlox
While I don't need this for EG itself, I still wanted to thank you for sharing!
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: EventGhost Application Control Plugin

Postby phlox » Tue Jul 24, 2012 4:46 pm

Here's a minor update: EventGhost Application Control 0.1.1 (download in the first post)

Changes
Code: Select all
#    Added action IsDirty

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.
phlox
Plugin Developer
 
Posts: 89
Joined: Wed Jan 11, 2012 3:49 pm

Re: EventGhost Application Control Plugin

Postby kalia » Sat Jul 28, 2012 4:29 am

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
kalia
Experienced User
 
Posts: 64
Joined: Wed Aug 12, 2009 1:10 am

Re: EventGhost Application Control Plugin

Postby blaher » Mon Nov 05, 2012 5:32 am

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.
blaher
Experienced User
 
Posts: 151
Joined: Thu Nov 17, 2011 1:27 am

Re: EventGhost Application Control Plugin

Postby phlox » Wed Nov 07, 2012 12:26 pm

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.
phlox
Plugin Developer
 
Posts: 89
Joined: Wed Jan 11, 2012 3:49 pm

Re: EventGhost Application Control Plugin

Postby piipes » Sat Nov 10, 2012 9:48 pm

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.
piipes
 
Posts: 31
Joined: Wed Mar 23, 2011 12:21 pm

Re: EventGhost Application Control Plugin

Postby phlox » Sun Nov 11, 2012 5:50 pm

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)
Last edited by phlox on Wed Nov 14, 2012 7:40 pm, edited 1 time in total.
phlox
Plugin Developer
 
Posts: 89
Joined: Wed Jan 11, 2012 3:49 pm

Re: EventGhost Application Control Plugin

Postby Pako » Mon Nov 12, 2012 1:06 pm

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
User avatar
Pako
Plugin Developer
 
Posts: 1282
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic

Re: EventGhost Application Control Plugin

Postby phlox » Mon Nov 12, 2012 8:02 pm

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)
phlox
Plugin Developer
 
Posts: 89
Joined: Wed Jan 11, 2012 3:49 pm

Re: EventGhost Application Control Plugin

Postby Pako » Tue Nov 13, 2012 6:25 am

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
User avatar
Pako
Plugin Developer
 
Posts: 1282
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic

Re: EventGhost Application Control Plugin

Postby blaher » Wed Nov 14, 2012 3:47 am

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. :)
blaher
Experienced User
 
Posts: 151
Joined: Thu Nov 17, 2011 1:27 am

Re: EventGhost Application Control Plugin

Postby phlox » Wed Nov 14, 2012 5:14 pm

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!
phlox
Plugin Developer
 
Posts: 89
Joined: Wed Jan 11, 2012 3:49 pm

Next

Return to Plugin Support

Who is online

Users browsing this forum: No registered users and 1 guest