AutoHotkey Community

It is currently May 26th, 2012, 1:08 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Arrow Keys Control Mouse
PostPosted: November 11th, 2007, 3:24 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2007, 3:26 am 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
combination of
SetTimer
getkeystate
mousemove

actually, look at the joystick to mouse script in the help file, it should be able to be modified.

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2007, 3:27 am 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
there is also a numpad mouse script (forum or help....don't remember)that would be even better for you.

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2007, 3:33 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2007, 3:37 am 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
please give example of what you mean

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2007, 3:41 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
this is what i mean its really slow

Left:: MouseMove, 0, 30,100,R


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2007, 3:53 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2007, 3:57 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2007, 4:01 am 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
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

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2007, 4:04 am 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
THX!

alot


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2007, 5:19 am 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
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


_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 16th, 2007, 6:37 pm 
Offline

Joined: February 24th, 2007, 6:02 pm
Posts: 175
Location: Budapest, Hungary
Nice script.

Just a little optimization: I think you can remove the xVal= and yVal= lines from the beginning of the script.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 24th, 2008, 4:17 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 29th, 2008, 11:23 pm 
Offline

Joined: September 24th, 2007, 9:05 am
Posts: 41
VERY NICE!!!!!

Gotta love the diagonal move movement! :-D

_________________
Bigrob

L337 Speak - A Ventrilo Client Side program

Winamp Sound Changer - Change Audio Output on the Fly!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 3rd, 2010, 3:01 am 
I am totally new this but i added to the above script

\::Click ;
Esc::ExitApp

now i can move the mouse and left click with \

no idea how to toggle it on/off , so as long you did
not press escape the \ key as it is, is not usable.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Klark92, Tilter_of_Windmills, vsub and 16 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group