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.

Control Mouse with tasker scene

If you have a question or need help, this is the place to be.
Post Reply
Javier
Experienced User
Posts: 73
Joined: Sun Dec 01, 2013 3:45 pm

Control Mouse with tasker scene

Post by Javier »

I am uploading a tasker project to control the computer mouse via eventghost because of interest on the google plus tasker community.

To use this project you must add the Broadcaster Plugin into Eventghost and install the UDP sender tasker plugin.

UDP Sender Plugin https://play.google.com/store/apps/deta ... nder&hl=en

Here is the event ghost XML to which allows the mouse to move, copy the code and paste it into EventGhost

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1700">
    <Folder Name="Touchpad Project" Expanded="True">
        <Macro Name="Tasker Mouse">
            <Event Name="Broadcast.Computer-Move" />
            <Action Name="Mouse Test">
                EventGhost.PythonScript(u'import math\ndir = eg.event.payload[0]\nval = int(eg.event.payload[1])/int(2)\n\n#print eg.globals.mousedir\n\nif dir == "right":\n    x = int(val)\n    #print x\n    eg.globals.mousex = x\n    eg.globals.mousey = int(0)\n    #print eg.globals.mousex\nif dir == "left":\n    a = val\n    #print a\n    #float(a)\n    #print a\n    b = -1\n    #print b\n    x = int(a)*int(b)\n    eg.globals.mousex = x\n    eg.globals.mousey = int(0)\n    #print eg.globals.mousex\n#int(float(eg.event.payload[2]\nif dir == "up":\n    a = val\n    b = -1\n    y = int(a)*int(b)\n    #print y\n    eg.globals.mousey = y\n    eg.globals.mousex = int(0)\n    #print eg.globals.mousey\nif dir =="down":\n    y = int(val)\n    #b = -1\n    #y = int(a)*int(b)\n    #print x\n    eg.globals.mousey = y\n    eg.globals.mousex = int(0)\n    #print eg.globals.mousey\nif dir == "upleft":\n    a = val\n    b = -1\n    y = int(a)*int(b)\n    eg.globals.mousey = y\n    eg.globals.mousex = y\nif dir == "upright":\n    a = val\n    b = -1\n    y = int(a)*int(b)\n    eg.globals.mousey = y\n    eg.globals.mousex = a\nif dir == "downleft":\n    a = val\n    b = -1\n    y = int(a)*int(b)\n    eg.globals.mousey = a\n    eg.globals.mousex = y\nif dir == "downright":\n    a = val\n    b = -1\n    y = int(a)*int(b)\n    eg.globals.mousey = a\n    eg.globals.mousex = a\nprint eg.globals.mousex\nprint eg.globals.mousey\n# The following is mouse\neg.plugins.Mouse.MoveRelative(int(float(eg.globals.mousex)), int(float(eg.globals.mousey)))\n')
            </Action>
        </Macro>
        <Macro Name="Left mouse button">
            <Event Name="Broadcast.Computer-enter" />
            <Action>
                Mouse.LeftButton()
            </Action>
        </Macro>
        <Macro Name="Right mouse button">
            <Event Name="Broadcast.Computer-back" />
            <Action>
                Mouse.RightButton()
            </Action>
            <Action>
                EventGhost.FlushEvents()
            </Action>
        </Macro>
    </Folder>
</EventGhost>

The tasker project is simple and just an example. after it is imported into tasker you will need to back out of tasker to save the project. Then open the task "Set Initial Variables And Launch Touchpad" then press run (the play button). You may also want to set initial variables in this task as ip address is set to broadcast to entire network 255.255.255.255 and port is the Broadcaster plugin default of 33333.
Attachments
Touchpad.prj.xml
Tasker Touchpad Project
(16.15 KiB) Downloaded 265 times
Post Reply