 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
dj_anubis Guest
|
Posted: Thu Sep 17, 2009 10:28 pm Post subject: keyboard to mouse |
|
|
hello
I need you help in a script which supposed to do the following thing:
I want that instead of pressing UP DOWN LEFT RIGHT UPRIGHT UPLEFT DOWNRIGHT DOWN LEFT, I will be able to move the mouse in these directions and the computer will think that i pressed on the keybaord
thank you |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 3254 Location: Simi Valley, CA
|
|
| Back to top |
|
 |
dj_anubis Guest
|
Posted: Thu Sep 17, 2009 11:08 pm Post subject: |
|
|
can you please help me with the coding
I am terrible in this stuff |
|
| Back to top |
|
 |
AnttiV
Joined: 14 Aug 2009 Posts: 237 Location: Finland
|
Posted: Sat Sep 19, 2009 8:35 am Post subject: |
|
|
| Windows already incorporates a feature called MouseKeys, if that's what you're looking for? to move the mouse pointer with keyboard? Look in Control Panel -> Accessibility |
|
| Back to top |
|
 |
dj_anubis Guest
|
Posted: Wed Sep 23, 2009 12:13 am Post subject: still need help.. |
|
|
no bro
I need it for something else
I need it for emulator its a long story
important:
i have a joystick with WATCHPOV
today i am using a script like this: (this script fo the following thing. when i move my joystick, the computer thinks i press certain keys)
| Code: | joyNum = 1
#Persistent ; Keep this script running until the user explicitly exits it.
SetTimer, WatchPOV, 10
return
WatchPOV:
GetKeyState, POV, JoyPOV ; Get position of the POV control.
KeyToHoldDownPrev = %KeyToHoldDown% ; Prev now holds the key that was down before (if any).
; Some joysticks might have a smooth/continous POV rather than one in fixed increments.
; To support them all, use a range:
if POV < 0 ; No angle to report
KeyToHoldDown =
;rem else if POV > 27000 ; 315 to 360 degrees: Forward
;rem KeyToHoldDown = Up
;ARROWS
;*******
else if POV = 0 ; 0 to 45 degrees: Forward
KeyToHoldDown = Up
else if POV = 9000 ; 45 to 135 degrees: Right
KeyToHoldDown = Right
else if POV = 18000 ; 135 to 225 degrees: Down
KeyToHoldDown = down
else if POV = 27000 ; 225 to 315 degrees: Left
KeyToHoldDown = Left
;DIAG
;****
else if POV between 9001 and 17999 ; 225 to 315 degrees: Left
KeyToHoldDown = downright
SetKeyDelay -1
If KeyToHoldDownPrev = downright
{
Send, {right up}{down up}
}
If KeyToHoldDown = downright
{
Send, {right down}{down down}
return
}
else if POV between 1 and 8999 ; 225 to 315 degrees: Left
KeyToHoldDown = upright
SetKeyDelay -1
If KeyToHoldDownPrev = upright
{
Send, {right up}{up up}
}
If KeyToHoldDown = upright
{
Send, {right down}{up down}
return
}
else if POV between 27001 and 35999 ; 225 to 315 degrees: Left
KeyToHoldDown = upleft
SetKeyDelay -1
If KeyToHoldDownPrev = upleft
{
Send, {left up}{up up}
}
If KeyToHoldDown = upleft
{
Send, {left down}{up down}
return
}
else if POV between 18001 and 26999 ; 225 to 315 degrees: Left
KeyToHoldDown = downleft
SetKeyDelay -1
If KeyToHoldDownPrev = downleft
{
Send, {left up}{down up}
}
If KeyToHoldDown = downleft
{
Send, {left down}{down down}
return
}
if KeyToHoldDown = %KeyToHoldDownPrev% ; The correct key is already down (or no key is needed).
return
; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1 ; Avoid delays between keystrokes.
if KeyToHoldDownPrev ; There is a previous key to release.
Send, {%KeyToHoldDownPrev% up} ; Release it.
if KeyToHoldDown ; There is a key to press down.
Send, {%KeyToHoldDown% down} ; Press it down.
return
1joy1::
Send {j down} ; Press the RALT down.
SetTimer, WaitFor1joy1, 50 ; Reduce the number 30 to 20 or 10 to send keys faster. Increase it to send slower.
return
WaitFor1joy1:
if not GetKeyState("1joy1") ; The button has been released.
{
Send {j up} ; Release the RALT.
SetTimer, WaitFor1joy1, off ; Stop monitoring the button.
return
}
; Since above didn't "return", the button is still being held down.
Send {j down} ; Send another RALT keystroke.
return
1joy2::
Send {m down} ; Press the RALT down.
SetTimer, WaitFor1joy2, 50 ; Reduce the number 30 to 20 or 10 to send keys faster. Increase it to send slower.
return
WaitFor1joy2:
if not GetKeyState("1joy2") ; The button has been released.
{
Send {m up} ; Release the RALT.
SetTimer, WaitFor1joy2, off ; Stop monitoring the button.
return
}
; Since above didn't "return", the button is still being held down.
Send {m down} ; Send another RALT keystroke.
return
|
I want that by moving the mouse to this directions the computer will "think" i moved the joystick
and by pressing the mouse buttons the computer will "think" i pressed the joystick buttons
buttom line, convery the joystick to mouse
hope you will help me.... |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|