Herein lies a collection of code I created to handle chained events. Like 123 on an IR remote control.

If you have macros or EventGhost Configuration Tree items you wish to share this is the place to do it.
Post Reply
Posts: 7
Joined: Sat Mar 30, 2019 5:50 pm

Herein lies a collection of code I created to handle chained events. Like 123 on an IR remote control.

Post by Mandamus » Mon Apr 01, 2019 8:47 pm

Not knowing and not having knowledge of how make eventghost handle multiple chained events one after the other, I created my own method to handle sequential events that are to be linked and handled as a single event.

My need was to create a method to handle three number sequences entered from a Microsoft MCE Infrared remote control.

So I hit 123 on the remote and it does a thing. or 345 or 519 or *11 or 1*#, etc.

The sequence will create a new event, for example, 123 would look appear as
which you would then use as an event to trigger your own actions.

The MCE remote is configured in Eventghost with HID service disabled. So events are intercepted by Eventghost as MceRemote.Num1 or MceRemote.Pound, etc.

You can paste the following code directly into Eventghost and from there you can add or remove events that you wish to chain. Events MUST occur in threes.

If you're using a remote control for example, you would add the number key events to the group where the exiting events are. Any other events can be added as well.

The sequence times out after 1 second after which any further entries will begin a new sequence. This is to prevent hanging events from clogging it up.

Of course you can feel free to use and modify this as your needs require.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-rc6">
    <Macro Name="multiple event chain" XML_Guid="{1BEF5C86-23D4-48FF-82B5-3A69C9D6629A}" Expanded="True">
        <Event Name="MceRemote.Num1" XML_Guid="{20931D38-35E0-4056-B1C8-B4782DD32103}" />
        <Event Name="MceRemote.Num2" XML_Guid="{8EB0757E-AE7E-4F03-BAEE-0FD2EB921DA7}" />
        <Event Name="MceRemote.Num3" XML_Guid="{1A806110-7885-4CD0-B8D5-E673C56AAEE1}" />
        <Event Name="MceRemote.Num4" XML_Guid="{177223BC-0963-41C4-A58F-808A0C8F329E}" />
        <Event Name="MceRemote.Num5" XML_Guid="{47089204-A41F-4A51-BBCF-B42A97361ACD}" />
        <Event Name="MceRemote.Num6" XML_Guid="{7DF520D7-A97F-4F24-AEA6-370D1339E9F0}" />
        <Event Name="MceRemote.Num7" XML_Guid="{C0EBFF3C-EB67-4C39-9071-80C2F6E0A23B}" />
        <Event Name="MceRemote.Num8" XML_Guid="{02FE3596-857D-4964-A62E-CA306856C7AC}" />
        <Event Name="MceRemote.Num9" XML_Guid="{FEAF4287-E7F6-4B36-A6FD-7B3BCD282BCE}" />
        <Event Name="MceRemote.Num0" XML_Guid="{5FADD73A-3FB0-4FA0-892A-CC3622CBC541}" />
        <Event Name="MceRemote.Star" XML_Guid="{967C30DA-C71B-4AB3-9473-5C0A9D2A0C96}" />
        <Event Name="MceRemote.Pound" XML_Guid="{1899B608-E1DF-4877-AA1B-FB3D9EC71BF7}" />
        <Action XML_Guid="{7B71C8B7-15EE-488D-8734-A90A700FADA1}">
            EventGhost.PythonScript(u'try:\n    eg.globals.setstring\nexcept :\n    eg.globals.first = ""\n    eg.globals.second = ""\n    eg.globals.third = ""\n    eg.globals.setstring=""\n    eg.globals.keytime = {eg.event.time}\n\nif (eg.event.time-1 &gt; eg.globals.keytime):\n    eg.globals.first = ""\n    eg.globals.second = ""\n    eg.globals.third = ""\n    eg.globals.setstring = ""\n    \n   \n\nif (eg.globals.first !="") and (eg.globals.second !=""):\n    x = next(iter({eg.event.suffix}))\n    eg.globals.third = x\n    eg.globals.setstring = eg.globals.first + eg.globals.second + eg.globals.third  \n    eg.TriggerEvent(prefix="Main",suffix="3keypress" + eg.globals.setstring)\n    eg.globals.first = ""\n    eg.globals.second = ""\n    eg.globals.third = ""\n    eg.globals.keytime = ""\n    exit()\n    \n    \nif (eg.globals.first !="") and (eg.globals.second ==""):\n    x = next(iter({eg.event.suffix}))\n    eg.globals.second = x\n    eg.globals.setstring = eg.globals.first + eg.globals.second + eg.globals.third\n    eg.globals.keytime= next(iter({eg.event.time}))\n    exit()\n    \nif (eg.globals.first==""):\n    x = next(iter({eg.event.suffix}))\n    eg.globals.first = x\n    eg.globals.setstring = eg.globals.first  + eg.globals.second + eg.globals.third\n    eg.globals.keytime= next(iter({eg.event.time}))\n    exit()\n\n\n\n\n')
        <Action Enabled="False" XML_Guid="{0471CF64-FD8C-48A4-9ED3-E2E733BC11AC}">
            EventGhost.ShowOSD(u'{eg.globals.setstring}', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (58, 222, 79), (0, 0, 0), 0, (500, 0), 1, 3.0, None)

Apparently the module "Multitap" is for use in linking multiple events like this. Good luck with that. I looked at the pages linked here from the module and it's just gibberish. So I made this.

Post Reply