Hello:
I recently discovered this nifty software, but I need some help to start a script. I am hoping to create a script to map mouse movements to the direction keys on the keyboard. So if the mouse moves up by a certain extent, then the key {up} is pressed, and so forth. As well, I would like to map the mouse button for other keys such as x,z,c, space, ect. Finally, I hope to be able to turn this on with a key press such as ctrl or when a window is active.
I collected bits of codes that will do part of these things, but I have no clue on where to start to piece them together. Any help would be greatly appreciated!
Thank you!
[Moved from Scripts & Functions forum. ~jaco0646]
map mouse axis movement to keyboard buttons
Started by
snowdream
, Oct 07 2009 12:30 AM
6 replies to this topic
#1
-
Posted 07 October 2009 - 12:30 AM
Gui, 93:+ToolWindow Sensitivity = 7 ; lower = more sensitive LCtrl:: ; the left control key is the hotkey Gui, 93:Show, x-1 y-1 w1 h1 +NoActivate, % (Toggle := !Toggle) ? "Mouse to Keys On" : "Mouse to Keys Off" SetTimer, WatchMouse, % Toggle ? 5 : "off" MouseGetPos, ox, oy Keywait, %A_ThisHotkey% return WatchMouse: MouseGetPos, nx, ny If ( Sensitivity < Abs( nx - ox ) ) { Send, % "{blind}" ( nx < ox ? "{Left}" : "{Right}" ) MouseMove, ox, ny+1-2*(ny > oy), 0 } If ( Sensitivity < Abs( ny - oy ) ) { Send, % "{blind}" ( ny < oy ? "{Up}" : "{Down}" ) MouseMove, nx+1-2*(nx > ox), oy, 0 } return #IfWinExist, Mouse to Keys On LButton::z MButton::x RButton::c XButton1::space XButton2::LAlt #IfWinExist:?:
#2
-
Posted 07 October 2009 - 05:33 AM
Thank you! That is a great framework to work with.
#3
-
Posted 07 October 2009 - 12:58 PM
The script didn't work VXE
I put it in a new file an ran it and it just sat there. Am I missing something other then copying and pasting the code you had posted?
I put it in a new file an ran it and it just sat there. Am I missing something other then copying and pasting the code you had posted?
#4
-
Posted 17 May 2010 - 01:33 PM
Did you press the 'ON' button ?The script didn't work VXE
I put it in a new file an ran it and it just sat there. Am I missing something other then copying and pasting the code you had posted?
LCtrl:: ; the left control key is the hotkey
#5
-
Posted 18 May 2010 - 02:03 AM
Thank you very much it works.
Is there a way to make it attacked after much more movement. For instance 30 pixels? Also I am confused why no window pops up because I see you used gui window.
And unrelated but do you know anything about maybe programming hot spots in gui window. Kind of like in those maps on websites where you click on various countries or something.
Is there a way to make it attacked after much more movement. For instance 30 pixels? Also I am confused why no window pops up because I see you used gui window.
And unrelated but do you know anything about maybe programming hot spots in gui window. Kind of like in those maps on websites where you click on various countries or something.
#6
-
Posted 19 May 2010 - 01:45 PM
Take a look at line 2, the variable "Sensitivity" is set to the number of pixels that you need to move the mouse before the script does anything. There is no visible window because is is (usually) off the screen. The gui window is simply there to trigger the #IfWinExist context.Thank you very much it works.
Is there a way to make it attacked after much more movement. For instance 30 pixels? Also I am confused why no window pops up because I see you used gui window.
Making rectangular hotspots that respond to mouseover is fairly simple (I think there are some examples... try searching for "WM_MOUSEMOVE" and "HWND" ).And unrelated but do you know anything about maybe programming hot spots in gui window. Kind of like in those maps on websites where you click on various countries or something.
#7
-
Posted 20 May 2010 - 03:32 AM