| View previous topic :: View next topic |
| Author |
Message |
Fry
Joined: 01 Nov 2007 Posts: 689
|
Posted: Sun Nov 11, 2007 2:24 am Post subject: Arrow Keys Control Mouse |
|
|
im making an autohotkey script to make the Arrow keys move the mouse
(UP=Move Mouse up ect etc)
how would i go about doing this?
a hotkey to move the mouse up?
thanks in advance |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1249 Location: USA
|
Posted: Sun Nov 11, 2007 2:26 am Post subject: |
|
|
combination of
SetTimer
getkeystate
mousemove
actually, look at the joystick to mouse script in the help file, it should be able to be modified. _________________
ʞɔпɟ əɥʇ ʇɐɥʍ |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1249 Location: USA
|
Posted: Sun Nov 11, 2007 2:27 am Post subject: |
|
|
there is also a numpad mouse script (forum or help....don't remember)that would be even better for you. _________________
ʞɔпɟ əɥʇ ʇɐɥʍ |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 689
|
Posted: Sun Nov 11, 2007 2:33 am Post subject: |
|
|
i figured it out but the maximum setting of how fast it goes is 100
and thats REALLY slow is there any other way to move it faster |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1249 Location: USA
|
Posted: Sun Nov 11, 2007 2:37 am Post subject: |
|
|
please give example of what you mean _________________
ʞɔпɟ əɥʇ ʇɐɥʍ |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 689
|
Posted: Sun Nov 11, 2007 2:41 am Post subject: |
|
|
this is what i mean its really slow
Left:: MouseMove, 0, 30,100,R |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 689
|
Posted: Sun Nov 11, 2007 2:53 am Post subject: |
|
|
Ok its working ....sorta
i press one hotkey and the other will somehow be pressed too
even return didnt work
| Code: | #SingleInstance Force
Up:: MouseMove, 0, -350,67,R
return
Down:: MouseMove, 0, 350,67,R
return
Left:: MouseMove, -350, 0,67,R
return
Right:: MouseMove, 350, 0,67,R
return |
|
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 689
|
Posted: Sun Nov 11, 2007 2:57 am Post subject: |
|
|
also it doesnt work like a mouse i want it to be able to move around like a real mouse
not just up down right left |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1249 Location: USA
|
Posted: Sun Nov 11, 2007 3:01 am Post subject: |
|
|
| Code: | SetBatchLines -1
IncrementValue = 5
MouseDelay = 0
Left::
Right::
Up::
Down::
Loop,
{
If (A_ThisHotkey = "Down")
xVal := 0, yVal := IncrementValue
If (A_ThisHotkey = "Up")
xVal := 0, yVal = -IncrementValue
If (A_ThisHotkey = "Left")
xVal := -IncrementValue, yVal = 0
If (A_ThisHotkey = "Right")
xVal := IncrementValue, yVal = 0
If GetKeyState(A_ThisHotKey, "P")
MouseMove, %xVal%, %yVal%,%MouseDelay%,R
Else
Break
}
return
Esc::ExitApp
|
_________________
ʞɔпɟ əɥʇ ʇɐɥʍ |
|
| Back to top |
|
 |
Fry
Joined: 01 Nov 2007 Posts: 689
|
Posted: Sun Nov 11, 2007 3:04 am Post subject: |
|
|
THX!
alot |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1249 Location: USA
|
Posted: Sun Nov 11, 2007 4:19 am Post subject: |
|
|
This is a little bit better, it moves faster the longer you hold down the key.
Edit:
-Toggle On/Off via capslock.
-can move diagonally by pressing 2 keys.
| Code: | SetBatchLines -1
#UseHook
Increment = 1 ; number of pixels to move mouse....gets multiplied depending on keypress length
MouseDelay = 0
Left::
Right::
Up::
Down::
xVal=
yVal=
If GetKeyState("CapsLock","T")
{
IncrementValue := Increment ; Set the Increment value (we change it)
; Infinite loop....breaks when key not pressed anymore
Loop,
{
If (A_Index > IncrementValue * 15) and (IncrementValue < Increment * 5) ; Increase the Increment value depending on how long we held down the key
IncrementValue := IncrementValue * 2
If GetKeyState("Down", "P")
yVal := IncrementValue
Else If GetKeyState("Up", "P")
yVal := -IncrementValue
If !yVal
yVal := 0
If GetKeyState("Left", "P")
xVal := -IncrementValue
Else If GetKeyState("Right", "P")
xVal := IncrementValue
If !xVal
xVal := 0
If GetKeyState(A_ThisHotKey, "P") ; Make sure we are still pressing the key
MouseMove, %xVal%, %yVal%,%MouseDelay%,R
Else ; we're not pressing the key...break the loop
Break
}
}
Else
Send % "{" . A_ThisHotKey . "}"
return
Esc::ExitApp
|
_________________
ʞɔпɟ əɥʇ ʇɐɥʍ |
|
| Back to top |
|
 |
HuBa
Joined: 24 Feb 2007 Posts: 172 Location: Budapest, Hungary
|
Posted: Sun Dec 16, 2007 5:37 pm Post subject: |
|
|
Nice script.
Just a little optimization: I think you can remove the xVal= and yVal= lines from the beginning of the script. |
|
| Back to top |
|
 |
me123 Guest
|
Posted: Wed Sep 24, 2008 3:17 am Post subject: why wont this script work if im using the send command |
|
|
im running a wirnlirc script and i want to use the remote keys to move the mouse
i love your script but it only works when using my keyboard but a send command doesn't
any help is greatly appreciated |
|
| Back to top |
|
 |
Bigrob55
Joined: 24 Sep 2007 Posts: 37
|
|
| Back to top |
|
 |
|