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.

Identify keypress combinations / Pass through keypresses

If you have a question or need help, this is the place to be.
Post Reply
tom.luft
Posts: 4
Joined: Mon Sep 30, 2013 10:05 am

Identify keypress combinations / Pass through keypresses

Post by tom.luft »

Is it possible to distinguish single keypresses from keypress combinations?
I know one can catch e.g. {LWin+D} but I want to achieve that my macro only reacts on {LWin} but not on any combinations like {LWin+D}, {LWin+R} etc.
I basically want to make my WIn 8 usable by replacing the Windows' button metro surface with Launchy so I can quickly launch applications without switching to this unconvenient, mouse unfriendly, happy-birthday-colored nightmare of squares whilst keeping all those handy combinations* intact.

*mainly +D, +R, +L, +Break
Last edited by tom.luft on Mon Jan 27, 2014 3:49 pm, edited 1 time in total.
tom.luft
Posts: 4
Joined: Mon Sep 30, 2013 10:05 am

Identify keypress combinations / Pass through keypresses

Post by tom.luft »

Ok so I figured it out by using a trick with a timer and auto-repeating to create KeyUp-Events (using a script from here).
If a combination with the Windows key is pressed, I just disable the macro starting Launchy.

My only problem now is passing those combinations through. I tried emulating the keypresses with {eg.event.suffix} as key, but it didn't work. Any suggestions?

The code is as follows: (note that I use {Ctrl+Alt+Page Up} to start Launchy)

Code: Select all

<Folder Name="Metro Killer" Expanded="True">
        <Macro Name="Deactivate Launchy start" Expanded="True">
            <Event Name="Keyboard.LWin+D" />
            <Event Name="Keyboard.LWin+L" />
            <Event Name="Keyboard.LWin+E" />
            <Event Name="Keyboard.LWin+R" />
            <Event Name="Keyboard.LWin+Pause" />
            <Event Name="Keyboard.LWin+F" />
            <Action Enabled="False">
                Window.SendKeys(u'{eg.event.suffix}', False)
            </Action>
            <Action>
                EventGhost.DisableItem(XmlIdLink(40))
            </Action>
            <Action>
                EventGhost.ShowOSD(u'{eg.event.suffix}', u'0;-24;0;0;0;700;0;0;0;1;0;0;2;32;Arial', (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, False)
            </Action>
        </Macro>
        <Macro Name="Create Key Up-Events" Expanded="True">
            <Event Name="Keyboard.LWin" />
            <Action>
                EventGhost.PythonCommand(u'eg.plugins.Timer.TimerAction(u\'KeyUp\', 0, 1, 0.15, eg.event.suffix+"_up", False, True, 1, u\'00:00:00\')')
            </Action>
            <Action>
                EventGhost.AutoRepeat(0.10000000000000001, 0.10000000000000001, 0.10000000000000001, 3.0)
            </Action>
            <Action>
                EventGhost.EnableItem(XmlIdLink(40))
            </Action>
        </Macro>
        <Macro Name="Start Launchy" id="40" Expanded="True">
            <Event Name="Timer.LWin_up" />
            <Action>
                Window.SendKeys(u'{Ctrl+Alt+PageUp}', False)
            </Action>
        </Macro>
    </Folder>
Last edited by tom.luft on Mon Jan 27, 2014 3:49 pm, edited 1 time in total.
tom.luft
Posts: 4
Joined: Mon Sep 30, 2013 10:05 am

Identify keypress combinations / Pass through keypresses

Post by tom.luft »

I just added a small python script and now it works:

Code: Select all

buttons = eg.event.suffix
eg.winkey_combination = '{'+buttons+'}'
I then used this variable (eg.winkey_combination) for the keystroke emulation.
Post Reply