I am wondering about an implemented solution to a problem I had.
So I am using the Microsoft MCE Remote (Vista+) to read an ir-transceiver usb dongle and an old ir remote I had lying around. With this I thought that it would be nice to have a set of things that my remote did like launch programs, shortcuts, call websites, play music, turn off/on lights/plugins at the house, plus control my soundbar and tv by blasting ir signals through the transceiver. All this was easy enough, but I had a bit of an issue, I needed context. I mean that if I had kodi open the controls needed would be better off remapped in many cases, if I had youtube.com/tv open I needed a slightly different key to search for instance, or maybe a program had a nice user control system, but it required different keys too. Hell if I got crazy enough I could automate programs with no interface/api via good old mouse navigation and clicks (although I am unaware of any program lacking simple keyboard shortcuts of some kind).
The point is that I needed situational awareness. If x program or window is open :: let keys equal y. Again context. What I came up with is the tree below:
Part one...

Part two... Alpha folder

And the tree for any interested:
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="0.5.0-rc4">
<Folder Name="switches" XML_Guid="{CB347555-72BF-4B6A-8034-C6292DCF7487}" Expanded="True">
<Folder Name="modes" XML_Guid="{7A0592F7-D595-4024-ADE6-6FC2B2BA7684}">
<Macro Name="Listen_Up button action" XML_Guid="{F4AC0B89-DAB4-47DF-A270-B978C5716E3B}" Expanded="True">
<Event Name="Keyboard.Ctrl+Space" XML_Guid="{509AB468-3AC9-426C-8C68-5BF996F2265D}" />
<Action XML_Guid="{C5047E65-C362-488A-A18D-09A4ADEBC90B}">
EventGhost.EnableItem(XmlIdLink(19))
</Action>
<Action XML_Guid="{C5047E65-C362-488A-A18D-09A4ADEBC90B}">
EventGhost.EnableItem(XmlIdLink(25))
</Action>
<Action XML_Guid="{C5047E65-C362-488A-A18D-09A4ADEBC90B}">
EventGhost.EnableItem(XmlIdLink(31))
</Action>
</Macro>
</Folder>
<Macro Name="state = a" id="19" Enabled="False" XML_Guid="{5ABB6182-6BAF-4E29-B53F-3C8A06279683}">
<Event Name="Keyboard.1" XML_Guid="{E43AB673-C517-41AF-90BA-523958B3E835}" />
<Action Name="buttons = state a" XML_Guid="{FF23F788-FB11-48D1-A02B-84D256DBFD76}">
EventGhost.Comment()
</Action>
<Action XML_Guid="{E4110300-10E1-4271-ADD3-2988A0216057}">
EventGhost.DisableItem(XmlIdLink(25))
</Action>
<Action XML_Guid="{E4110300-10E1-4271-ADD3-2988A0216057}">
EventGhost.DisableItem(XmlIdLink(31))
</Action>
<Action XML_Guid="{17E825F9-348E-41BB-AD8E-DA449855D3BC}">
EventGhost.TriggerEvent(u'State_A', 0.0)
</Action>
</Macro>
<Macro Name="state = b" id="25" Enabled="False" XML_Guid="{2403E9F8-E1F5-43CD-B12A-B0828D2293F7}">
<Event Name="Keyboard.2" XML_Guid="{B4538A13-1566-406A-AB7D-F53D11EB76B1}" />
<Action Name="buttons = state b" XML_Guid="{FF23F788-FB11-48D1-A02B-84D256DBFD76}">
EventGhost.Comment()
</Action>
<Action XML_Guid="{E4110300-10E1-4271-ADD3-2988A0216057}">
EventGhost.DisableItem(XmlIdLink(19))
</Action>
<Action XML_Guid="{E4110300-10E1-4271-ADD3-2988A0216057}">
EventGhost.DisableItem(XmlIdLink(31))
</Action>
<Action XML_Guid="{17E825F9-348E-41BB-AD8E-DA449855D3BC}">
EventGhost.TriggerEvent(u'State_B', 0.0)
</Action>
</Macro>
<Macro Name="state = c" id="31" Enabled="False" XML_Guid="{96CAB14D-4E58-40FB-8ABC-776A10304BA8}">
<Event Name="Keyboard.3" XML_Guid="{3DD0E389-8788-4784-B609-EE19718811D4}" />
<Action Name="buttons = state c" XML_Guid="{FF23F788-FB11-48D1-A02B-84D256DBFD76}">
EventGhost.Comment()
</Action>
<Action XML_Guid="{E4110300-10E1-4271-ADD3-2988A0216057}">
EventGhost.DisableItem(XmlIdLink(19))
</Action>
<Action XML_Guid="{E4110300-10E1-4271-ADD3-2988A0216057}">
EventGhost.DisableItem(XmlIdLink(25))
</Action>
<Action XML_Guid="{17E825F9-348E-41BB-AD8E-DA449855D3BC}">
EventGhost.TriggerEvent(u'State_C', 0.0)
</Action>
</Macro>
<Folder Name="Alpha" XML_Guid="{A657611B-A31A-4EE0-829F-928A6F99EA7F}">
<Macro Name="A" XML_Guid="{15F8CE85-C55C-4304-B454-7BC11614B401}" Expanded="True">
<Event Name="Main.State_A" XML_Guid="{80F7AAA4-2971-4FE3-8994-E4387092C2D8}" />
<Action XML_Guid="{E4110300-10E1-4271-ADD3-2988A0216057}">
EventGhost.DisableItem(XmlIdLink(19))
</Action>
<Action XML_Guid="{F736EE13-4D5B-4CCF-93A4-005066B8C5BC}">
System.Execute(u'', u'', 0, False, 2, u'', False, False, u'', False, False, False, False)
</Action>
<Action Name="Enable/Disable Further Macros/Events, set controls" XML_Guid="{FF23F788-FB11-48D1-A02B-84D256DBFD76}">
EventGhost.Comment()
</Action>
</Macro>
<Macro Name="B" XML_Guid="{AAD3443F-8D96-42A7-BA63-7107F5F2856F}" Expanded="True">
<Event Name="Main.State_B" XML_Guid="{97D45EB2-2E53-4961-BFBE-3ED2DC9C4F86}" />
<Action XML_Guid="{E4110300-10E1-4271-ADD3-2988A0216057}">
EventGhost.DisableItem(XmlIdLink(25))
</Action>
<Action XML_Guid="{F736EE13-4D5B-4CCF-93A4-005066B8C5BC}">
System.Execute(u'', u'', 0, False, 2, u'', False, False, u'', False, False, False, False)
</Action>
<Action Name="Enable/Disable Further Macros/Events, set controls" XML_Guid="{FF23F788-FB11-48D1-A02B-84D256DBFD76}">
EventGhost.Comment()
</Action>
</Macro>
<Macro Name="C" XML_Guid="{B60E8B4E-E232-45A3-9A67-F2D2971B06F0}" Expanded="True">
<Event Name="Main.State_C" XML_Guid="{5BC2A139-5A87-42E6-8304-BF5675796F01}" />
<Action XML_Guid="{F736EE13-4D5B-4CCF-93A4-005066B8C5BC}">
System.Execute(u'', u'', 0, False, 2, u'', False, False, u'', False, False, False, False)
</Action>
<Action XML_Guid="{E4110300-10E1-4271-ADD3-2988A0216057}">
EventGhost.DisableItem(XmlIdLink(31))
</Action>
<Action Name="Enable/Disable Further Macros/Events, set controls" XML_Guid="{FF23F788-FB11-48D1-A02B-84D256DBFD76}">
EventGhost.Comment()
</Action>
</Macro>
</Folder>
</Folder>
</EventGhost>