Hello all,
I'm busy with a project for school and fabricated a mouse-like device, that is, it doesn't look like a mouse, but has a ps2 connector and moves my cursor very nicely around the screen...unfortinately I haven't been so smart and now figured out that I need to invert the mouse axis, or rebuild the thing.
I found on internet a file which should invert the axis, but doesn't work for me...
; Script for AutoHotKeys, http://autohotkey.com/
; Inverts the mouse along the y axis. Works great, but not in games or other
; apps that use DirectInput.
#SingleInstance
#Persistent
SetBatchLines, 10ms
;CoordMode, Mouse, Screen
BlockInput, Mouse
SetMouseDelay, -1 ; Makes movement smoother.
oldy = 0 ; initial value
SetTimer, WatchMouse, 1
return
WatchMouse:
IfWinNotActive, Beyond Good & Evil - Ubisoft
return
MouseGetPos, x, y,
delta = %y%
delta -= %oldy%
if delta <> 0
{
delta *= -2
MouseMove, 0, %delta%, 0, R
MouseGetPos, x, oldy
}
return
What could I change in the script in order to make it work?
greetz, Frans
Invert mouse axis
Started by
Frans
, May 20 2007 07:01 PM
28 replies to this topic
#1
-
Posted 20 May 2007 - 07:01 PM
I'm afraid I can't help you, but I tried to google around a bit and found someone who was in the exact same situation as you:
http://answers.googl...dview?id=408579
Since the script you pasted doesn't work in your game, I'm not sure any AutoHotkey scripts will??
http://answers.googl...dview?id=408579
Since the script you pasted doesn't work in your game, I'm not sure any AutoHotkey scripts will??
#2
-
Posted 20 May 2007 - 11:05 PM
The problem is that It doesn't work at al...I don't want to use it in a gaming environment, just in windows.. But thanks for your reply anyway!
#3
-
Posted 21 May 2007 - 12:49 AM
This should invert the y (vertical) direction of the mouse:
BlockInput Mouse SetMouseDelay -1 MouseGetPos x, oldy SetTimer WatchMouse, 1 Return WatchMouse: MouseGetPos x, y MouseMove 0, 2*(oldy-y), 0, R MouseGetPos x, oldy Return !z::ExitAppThis version inverts both axes
BlockInput Mouse SetMouseDelay -1 MouseGetPos x0, y0 SetTimer WatchMouse, 1 Return WatchMouse: MouseGetPos x, y MouseMove 2*(x0-x), 2*(y0-y), 0, R MouseGetPos x0, y0 Return !z::ExitApp
#4
-
Posted 21 May 2007 - 01:19 AM
Nice work Laszlo, although it seemed a little bit bumpy, this worked like a charm for me. But do you think it will work in the game that was requested considering the other script did not?
P.S. Don't dive below the taskbar with this thing on! : )
P.S. Don't dive below the taskbar with this thing on! : )
#5
-
Posted 21 May 2007 - 01:35 AM
These scripts fail at the screen edges, because you cannot move the mouse any more out, what was necessary to move the pointer away from the edge.
This kind of mouse movement manipulation is always jerky a bit, because of the processing time and the timer routine, which cannot be activated more often than every 10..16ms, the Windows timer resolution.
This kind of mouse movement manipulation is always jerky a bit, because of the processing time and the timer routine, which cannot be activated more often than every 10..16ms, the Windows timer resolution.
#6
-
Posted 21 May 2007 - 01:44 AM
Here is a version of the x/y script, which does not fail on the screen edges: it keeps the mouse pointer 1 pixel from the sides.
#NoEnv SetBatchLines -1 Process Priority,,R BlockInput Mouse ; user mouse input is ignored during MouseMove CoordMode Mouse, Screen ; absolute coordinates SysGet m, Monitor ; get the screen edges mLeft += 1, mRight -= 2, mTop += 1, mBottom -= 2 SetMouseDelay -1 ; fastest action MouseGetPos x0, y0 ; get initial mouse pointer location SetTimer WatchMouse, 1 ; run the subroutine fast (10..16ms) Return WatchMouse: MouseGetPos x, y ; get current mouse position x0 += 2*(x0-x), x0 := x0 < mLeft ? mLeft : (x0 > mRight ? mRight : x0) y0 += 2*(y0-y), y0 := y0 < mTop ? mTop : (y0 > mBottom ? mBottom : y0) MouseMove x0, y0, 0 ; set new position as old, for the next timer Return !z::ExitApp ; stop the madness; make the script persistent
#7
-
Posted 21 May 2007 - 02:27 AM
THANK YOU ALL!
for helping me out, it works perfectly! I'm really interested in learning how to use Autohotkey now! Thanks again for the posts!
Greetz, Frans
for helping me out, it works perfectly! I'm really interested in learning how to use Autohotkey now! Thanks again for the posts!
Greetz, Frans
#8
-
Posted 21 May 2007 - 11:00 AM
Is there any way you could also post a script for just the y-axis that doesn't fail at the edges?
#9
-
Posted 29 May 2007 - 04:09 AM
#NoEnv SetBatchLines -1 Process Priority,,R BlockInput Mouse ; user mouse input is ignored during MouseMove CoordMode Mouse, Screen ; absolute coordinates SysGet m, Monitor ; get the screen edges mTop += 1, mBottom -= 2 SetMouseDelay -1 ; fastest action MouseGetPos x0, y0 ; get initial mouse pointer location SetTimer WatchMouse, 1 ; run the subroutine fast (10..16ms) Return WatchMouse: MouseGetPos x, y ; get current mouse position y0 += 2*(y0-y), y0 := y0 < mTop ? mTop : (y0 > mBottom ? mBottom : y0) MouseMove x, y0, 0 ; set new position as old, for the next timer Return !z::ExitApp ; stop the madness; make the script persistent
#10
-
Posted 29 May 2007 - 02:09 PM
#NoEnv SetBatchLines -1 Process Priority,,R BlockInput Mouse ; user mouse input is ignored during MouseMove CoordMode Mouse, Screen ; absolute coordinates SysGet m, Monitor ; get the screen edges mTop += 1, mBottom -= 2 SetMouseDelay -1 ; fastest action MouseGetPos x0, y0 ; get initial mouse pointer location SetTimer WatchMouse, 1 ; run the subroutine fast (10..16ms) Return WatchMouse: MouseGetPos x, y ; get current mouse position y0 += 2*(y0-y), y0 := y0 < mTop ? mTop : (y0 > mBottom ? mBottom : y0) MouseMove x0, y0, 0 ; set new position as old, for the next timer Return !z::ExitApp ; stop the madness; make the script persistent
#12
-
Posted 29 May 2007 - 10:51 PM
When i add a hotkey (so while you are pressing it) it does not work?
#13
-
Posted 30 May 2007 - 10:26 PM
The hotkey should start/stop the timer WatchMouse (On/Off).
#14
-
Posted 31 May 2007 - 12:06 AM
Here is a version of the x/y script, which does not fail on the screen edges: it keeps the mouse pointer 1 pixel from the sides.
...
Unfortunately none of it didn't work with digitizer input on TabletPC.
any other ideas how to revert tablet stylus movement?
#15
-
Posted 05 May 2008 - 09:39 PM