Page 1 of 1

Triple-tap Keys

Posted: Sat Jul 05, 2008 12:50 am
by vrienduinen
Has anyone made a plugin that does Triple-tap Keys like x10commander.
http://thegreenbutton.com/forums/1/4767 ... hread.aspx

Re: Triple-tap Keys

Posted: Sat Jul 05, 2008 7:06 am
by topix
If I understand you right, you want to enter text like on a cell phone? rupi99 made an example for the keys 2 and 3. http://www.eventghost.org/forum/viewtop ... andy#p5169

And here is a script i just wrote:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1446">
    <Folder Name="Triple-Tap Keys">
        <Macro Name="Prepare TTK">
            <Event Name="Main.OnInit" />
            <Action>
                EventGhost.PythonCommand(u'ttk_key= " "')
            </Action>
            <Action>
                EventGhost.PythonCommand(u'taps = 0')
            </Action>
            <Action>
                EventGhost.NewJumpIf(XmlIdLink(156), 2, True)
            </Action>
            <Action>
                Timer.TimerAction(u'ttk', 0, 1, 1.0, u'ttk', False, True, 1, u'00:00:00')
            </Action>
            <Action>
                EventGhost.Wait(1.1000000000000001)
            </Action>
            <Action>
                EventGhost.FlushEvents()
            </Action>
        </Macro>
        <Macro Name="Get input">
            <Event Name="DesktopRemote.1" />
            <Event Name="DesktopRemote.2" />
            <Event Name="DesktopRemote.3" />
            <Event Name="DesktopRemote.4" />
            <Event Name="DesktopRemote.5" />
            <Event Name="DesktopRemote.6" />
            <Event Name="DesktopRemote.7" />
            <Event Name="DesktopRemote.8" />
            <Event Name="DesktopRemote.9" />
            <Event Name="DesktopRemote.0" />
            <Action>
                EventGhost.PythonCommand(u'taps = taps + 1')
            </Action>
            <Action>
                EventGhost.PythonCommand(u'if taps > len(ttk[eg.event.string]) : taps = 1')
            </Action>
            <Action>
                EventGhost.PythonCommand(u'ttk_key = ttk[eg.event.string][taps-1]')
            </Action>
            <Action>
                EventGhost.ShowOSD(u'{ttk_key}', u'0;-32;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (0, 202, 0), (0, 0, 0), 4, (0, 0), 0, 3.0, False)
            </Action>
            <Action>
                Timer.TimerAction(u'ttk', 1, 1, 1.0, u'ttk-2-', True, True, 0, u'00:00:00')
            </Action>
        </Macro>
        <Macro Name="Type key">
            <Event Name="Timer.ttk" />
            <Action>
                EventGhost.PythonCommand(u'taps = 0')
            </Action>
            <Action>
                EventGhost.ShowOSD(u'Selected key: {ttk_key}', u'0;-32;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (0, 202, 0), (0, 0, 0), 4, (0, 0), 0, 3.0, False)
            </Action>
        </Macro>
        <Folder Name="Shift">
            <Folder Name="Shift a-z" id="155">
                <Macro Name="Presets a-z" id="156">
                    <Action>
                        EventGhost.PythonCommand(u'ttk = { "DesktopRemote.1":(".", ",", "?", "!", "\'", "\\"", "1", "(", ")", "@", "/", ":", "_"), "DesktopRemote.2":("a", "b", "c", "2", u"\xe4"), "DesktopRemote.3":("d", "e", "f", "3"), "DesktopRemote.4":("g", "h", "i", "4"), "DesktopRemote.5":("j", "k", "l", "5"), "DesktopRemote.6":("m", "n", "o", "6", u"\xf6"), "DesktopRemote.7":("p", "q", "r", "s", "7", u"\xdf"), "DesktopRemote.8":("t", "u", "v", "8", u"\xfc"), "DesktopRemote.9":("w", "x", "y", "z", "9"), "DesktopRemote.0":(" ", "0") }')
                    </Action>
                </Macro>
                <Macro Name="Aktiviere exklusiv: Shift A-Z">
                    <Event Name="DesktopRemote.AV" />
                    <Action>
                        EventGhost.NewJumpIf(XmlIdLink(172), 2, True)
                    </Action>
                    <Action>
                        EventGhost.EnableExclusive(XmlIdLink(171))
                    </Action>
                </Macro>
            </Folder>
            <Folder Name="Shift A-Z" id="171" Enabled="False">
                <Macro Name="Presets A-Z" id="172">
                    <Action>
                        EventGhost.PythonCommand(u'ttk = { "DesktopRemote.1":(".", ",", "?", "!", "\'", "\\"", "1", "(", ")", "@", "/", ":", "_"), "DesktopRemote.2":("A", "B", "C", "2", u"\xc4"), "DesktopRemote.3":("D", "E", "F", "3"), "DesktopRemote.4":("G", "H", "I", "4"), "DesktopRemote.5":("J", "K", "L", "5"), "DesktopRemote.6":("M", "N", "O", "6", u"\xd6"), "DesktopRemote.7":("P", "Q", "R", "S", "7", u"\xdf"), "DesktopRemote.8":("T", "U", "V", "8", u"\xdc"), "DesktopRemote.9":("W", "X", "Y", "Z", "9"), "DesktopRemote.0":(" ", "0") }')
                    </Action>
                </Macro>
                <Macro Name="Aktiviere exklusiv: Shift 0-1">
                    <Event Name="DesktopRemote.AV" />
                    <Action>
                        EventGhost.NewJumpIf(XmlIdLink(188), 2, True)
                    </Action>
                    <Action>
                        EventGhost.EnableExclusive(XmlIdLink(187))
                    </Action>
                </Macro>
            </Folder>
            <Folder Name="Shift 0-9" id="187" Enabled="False">
                <Macro Name="Presets 0-9" id="188">
                    <Action>
                        EventGhost.PythonCommand(u'ttk = { "DesktopRemote.1":("1",), "DesktopRemote.2":("2",), "DesktopRemote.3":("3",), "DesktopRemote.4":("4",), "DesktopRemote.5":("5",), "DesktopRemote.6":("6",), "DesktopRemote.7":("7",), "DesktopRemote.8":("8",), "DesktopRemote.9":("9",), "DesktopRemote.0":("0",) }')
                    </Action>
                </Macro>
                <Macro Name="Aktiviere exklusiv: Shift a-z">
                    <Event Name="DesktopRemote.AV" />
                    <Action>
                        EventGhost.NewJumpIf(XmlIdLink(156), 2, True)
                    </Action>
                    <Action>
                        EventGhost.EnableExclusive(XmlIdLink(155))
                    </Action>
                </Macro>
            </Folder>
        </Folder>
    </Folder>
</EventGhost>
You have to replace all event-names with event-names of your remote. For example replace all DesktopRemote.1 with X10.num1, DesktopRemote.2 with X10.num2, etc. .

I have attached a complete configuration to test it with the DesktopRemote. The AV-Butten switches between a-z, A-Z, 0-9.

Re: Triple-tap Keys

Posted: Sun Jul 06, 2008 4:07 pm
by jsonnabend
That's an awsome macro. Thanks for posting that.

I have a stupid question: how do I import the XML file into my current configuration XML?

- Jeff

Re: Triple-tap Keys

Posted: Sun Jul 06, 2008 6:51 pm
by topix
Add the plugins 'Desktop Remote' and 'Timer' to your configuration. Then copy the above code and paste it in your configuration tree.

Re: Triple-tap Keys

Posted: Sat Sep 19, 2009 9:54 am
by Lococo
I have a Question to the Triple Tap Keys.
Could you Edit the Code, so when i Press as EXample:
1 (then it writes a, b, c etc.) but if i instantly press 2 (d, e, f) it didn't write the letter before.
When i write with my Handy it Displays the last letter which i looked for when i press the next Button from the Keys.

So: I want that the Button from the first Key get written when i choose a other Key.

Could you please do this for me?

mfg

Re: Triple-tap Keys

Posted: Tue Sep 22, 2009 1:06 pm
by Pako
I think your problem is solved by using plugin Multitap.
You can look into a brief guide to him.
Multitap is part of the installation EventGhost.
Pako