Page 1 of 1

Relative mouse move

Posted: Sat Jan 12, 2008 2:26 am
by smr888
Would it be possible for you to implement a relative mouse move as an action? There are many situations, particularly when using a remote, that it would be useful to be able to walk a list by, say, moving the mouse cursor down 50 pixels over and over. Thanks!

Re: Relative mouse move

Posted: Fri Jan 18, 2008 7:01 am
by stisev
Interesting request. I'm interested in this as well.

Re: Relative mouse move

Posted: Sun Jan 20, 2008 11:27 pm
by specter333
Here's a solution that uses another program, Auto Hot Keys, triggered from EG. It may be useful as a work around until EG can implement it on it's own.

Included in the zip file are four short programs that will move your mouse 50 pixels up, down, left or right as designated by the u,d,l or r at the end of the file name. Since EG has the ability to click the mouse after it's moved I didn't add click to the script.

Simple use the EG "Start a program" plug in to run each file and assign a button on your remote to trigger EG. It should move your mouse from it's current location without changing window focus or even seeing it run.

I use this method all the time to use my remote to work in certain applications. The script can be made to make sure the correct window is in focus or bring it to front if not, execute a command from one of the programs menus or have the mouse click on the programs buttons or links. It could then close the app or move the window back to the position it was in before being brought into focus.

Hopefully this will work for you. Enjoy, Rich

Re: Relative mouse move

Posted: Fri Feb 08, 2008 2:40 am
by ste-vv
Just wanted to share way to implement relative mouse movement within eventghost (this is sample):

Create a python script (copy and paste this into eventghost):

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1242">
<Action>
EventGhost.PythonScript(u'from win32api import mouse_event, GetCursorPos, SetCursorPos\n\nx = 50\ny = -50\ntry:\n old_x, old_y = GetCursorPos()\n SetCursorPos((old_x + x, old_y + y))\nexcept:\n pass')
</Action>
</EventGhost>


in this case if you execute the script as above the mouse will move to right 50 pixels and up 50 pixels
just edit x and y add you get whatever you want - I used this to control a program that would only respond to screen position mouse clicks - NO windows API whatsoever !!

Re: Relative mouse move

Posted: Sun Feb 10, 2008 10:53 pm
by jinxdone
I just committed a new version of the mouse plugin which adds this functionality. It should be present in the next beta.

In the meantime if you want to try it out you can grab the new file here, put it in your EventGhost/plugins/Mouse/ directory overwriting the old __init__.py. Finally restart EventGhost and you should be running the new version.

-jinxdone

Re: Relative mouse move

Posted: Tue May 13, 2008 3:27 am
by tkp
Could you explain the role of the AddUpFunc function? I suspect that it causes problems within the mouse emulation. In particular, the single click emulation rarely works and the double-click emulation often gets stuck in the mouse button down position. The use of the AddUpFunc seems to fit the bill as the culprit.

Re: Relative mouse move

Posted: Fri May 23, 2008 9:20 pm
by Bitmonster
The UpFunc gets called, when the event that triggered the action is released (the remote button is released). Which plugin are you using to initiate the mouse actions?