(Mouse) Movements/Clicks & Typing (Keyboard Emulation) DEMO

Tutorials & Guides

(Mouse) Movements/Clicks & Typing (Keyboard Emulation) DEMO

Postby HenryMast » Sat Jun 24, 2017 9:32 am

I am quite experienced Tasker user but pretty new to EventGhost and I immediately faced a difficulty getting EventGhost's Mouse and Keyboard Emulation to work together.

I asked advice here in the forum to solve this problem but like in most cases I don't ask advice and trying to figure out on my own through experimentation. Which is probably a slower path but because I do it so frequently I've gotten pretty good at figuring things out by experimentation and so here is the solution below that I discovered.

It seems that Mouse actions like click and double-click do not work with typing when put into the same macro. So what you have to do, or at least one way around it that I discovered, is to do the Mouse macro first, and then at the end of the macro you simply trigger own custom event that activates the macro that runs Keyboard Emulation (probably works vice-versa as well but haven't tested), so you can let EventGhost to go to places with mouse and let it type text to specific fields you want.

Posted the xml demostration below as well (can save the below as xml with notepad to open with EventGhost).

Cheers,
Henry

Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1722" Guid="{D6130EC1-EF21-48DF-8AA3-2331B340B3CE}" Time="1498295172.3">
    <Autostart Name="Autostart" Expanded="True">
        <Plugin Identifier="X10" Guid="{C3E96757-E507-4CC3-A2E6-465D48B87D09}" File="X10">
            gAJLAl1xAChLAUsCSwNLBEsFSwZLB0sISwlLCksLSwxLDUsOSw9LEGVYAwAAAFgxMHEBh3ECLg==
        </Plugin>
        <Plugin Identifier="ZoomPlayer" Guid="{C5E2609E-C1C4-4432-A532-EDA79A7EE41D}" File="ZoomPlayer">
            gAIoWAkAAABsb2NhbGhvc3RxAE2hEoiJdHEBLg==
        </Plugin>
        <Plugin Identifier="Winamp" Guid="{4A22DD6A-5E2C-4500-90B4-47F5C58FD9CA}" File="Winamp">
            gAIpLg==
        </Plugin>
        <Plugin Identifier="Task" Guid="{D1748551-C605-4423-B392-FB77E6842437}" File="Task">
            gAIpLg==
        </Plugin>
        <Action>
            EventGhost.EnableExclusive(XmlIdLink(335))
        </Action>
        <Plugin Enabled="False" Identifier="DirectoryWatcher" Guid="{003FABA6-AA6A-4395-9DB6-DC88EB07F5FE}" File="DirectoryWatcher">
            gAJYAwAAAEM6XHEAiYZxAS4=
        </Plugin>
        <Plugin Identifier="Process" Guid="{82BADF9F-D809-4EBC-A540-CCBF7563F8DF}" File="ProcessWatcher">
            gAIpLg==
        </Plugin>
        <Plugin Identifier="Scheduler" Guid="{5C822DE2-97E7-4DB8-8281-CD77ED216A63}" File="Scheduler">
            gAIoWCIAAAAwMTAxLDA1MDEsMDYwNiwxMjI0LDEyMjUsMTIyNiwxMjMxcQBYEwAAADAxMDYsMDMyMSwwMzI0LDA2MjBxAYmJWAQAAABNYWlucQJ0cQMu
        </Plugin>
    </Autostart>
    <Folder Name="Wordpad Profile" Expanded="True">
        <Macro Name="OpWordpadForInternTYPE--working (switch the profile on and click on your desktop to trigger it)" id="467" Enabled="False">
            <Event Name="Task.Activated.Desktop" />
            <Action>
                EventGhost.Wait(1.0)
            </Action>
            <Action>
                System.Execute(u'C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe', u'', 2, False, 2, u'', False, False, u'', False, False, False, False)
            </Action>
            <Action>
                Window.FindWindow(u'wordpad.exe', u'Document - WordPad', u'WordPadClass', None, None, None, False, 5.0, 0)
            </Action>
            <Action>
                Mouse.MoveAbsolute(70, 86, 0, False, False)
            </Action>
            <Action>
                Mouse.LeftButton()
            </Action>
            <Action>
                EventGhost.DisableItem(XmlIdLink(467))
            </Action>
            <Action>
                EventGhost.EnableItem(XmlIdLink(483))
            </Action>
            <Action>
                EventGhost.Wait(1.0)
            </Action>
            <Action>
                EventGhost.TriggerEvent(u'TriggersType--times-new-roman', 0.0)
            </Action>
        </Macro>
    </Folder>
    <Folder Name="Related Tasks " Expanded="True">
        <Macro Name="wordpad-left-mose-button" id="479" Enabled="False">
            <Event Name="Main.TriggersLeftMouseButton" />
            <Action>
                Mouse.LeftButton()
            </Action>
            <Action>
                EventGhost.DisableItem(XmlIdLink(479))
            </Action>
        </Macro>
        <Macro Name="Emulate Keystrokes: times new roman" id="483" Enabled="False">
            <Event Name="Main.TriggersType--times-new-roman" />
            <Action>
                Window.SendKeys(u'Times {Enter}', False, 2)
            </Action>
            <Action>
                EventGhost.DisableItem(XmlIdLink(483))
            </Action>
            <Action>
                EventGhost.EnableItem(XmlIdLink(504))
            </Action>
            <Action>
                EventGhost.Wait(1.0)
            </Action>
            <Action>
                EventGhost.TriggerEvent(u'MovesToWordPadTextSize', 0.0)
            </Action>
        </Macro>
        <Macro Name="MovesToWordPadTextSize" id="504" Enabled="False">
            <Event Name="Main.MovesToWordPadTextSize" />
            <Action>
                Mouse.MoveAbsolute(195, 86, None, False, False)
            </Action>
            <Action>
                Mouse.LeftButton()
            </Action>
            <Action>
                EventGhost.DisableItem(XmlIdLink(504))
            </Action>
            <Action>
                EventGhost.EnableItem(XmlIdLink(499))
            </Action>
            <Action>
                EventGhost.Wait(1.0)
            </Action>
            <Action>
                EventGhost.TriggerEvent(u'TriggersType--text-size-14', 0.0)
            </Action>
        </Macro>
        <Macro Name="Emulate Keystrokes: 14" id="499" Enabled="False">
            <Event Name="Main.TriggersType--text-size-14" />
            <Action>
                Window.SendKeys(u'14 {Enter}', False, 2)
            </Action>
            <Action>
                EventGhost.DisableItem(XmlIdLink(499))
            </Action>
            <Action>
                EventGhost.EnableItem(XmlIdLink(515))
            </Action>
            <Action>
                EventGhost.Wait(1.0)
            </Action>
            <Action>
                EventGhost.TriggerEvent(u'RestoreWindowAndResize600', 0.0)
            </Action>
        </Macro>
        <Macro Name="RestoresWindowAndResizesTo600" id="515" Enabled="False">
            <Event Name="Main.RestoreWindowAndResize600" />
            <Action>
                Window.Restore()
            </Action>
            <Action>
                Window.Resize(600, 600)
            </Action>
            <Action>
                EventGhost.DisableItem(XmlIdLink(515))
            </Action>
        </Macro>
    </Folder>
</EventGhost>
HenryMast
 
Posts: 7
Joined: Sat Jun 24, 2017 4:40 am

Return to Tutorials & Guides

Who is online

Users browsing this forum: No registered users and 1 guest