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.
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.
Relative mouse move
Relative mouse move
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
Interesting request. I'm interested in this as well.
-
specter333
- Experienced User
- Posts: 95
- Joined: Thu Dec 27, 2007 12:26 am
Re: Relative mouse move
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
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
- Attachments
-
- mousemove.zip
- (767.94 KiB) Downloaded 349 times
Re: Relative mouse move
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 !!
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
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
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
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.
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: Relative mouse move
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?
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!