Jump to content

Move the mouse with arrow keys


Achilles
 Share

Recommended Posts

This is probably completely useless but it's still cool

#Include <Misc.au3>
$distance = 15
$speed = 3

AdlibEnable('_MouseFree', 20)

While 1 
    $pos = MouseGetPos()
    If BitAND(_IsPressed('A2'), _ISpressed('58')) or BitAND(_IsPressed('A3'), _ISpressed('58')) Then Exit
    If _IsPressed('25') then MouseMove($pos[0] - $distance, $pos[1] , $speed = 3)
    If _IsPressed('26') then MouseMove($pos[0], $pos[1]  - $distance, $speed = 3)
    If _IsPressed('27') then MouseMove($pos[0] + $distance, $pos[1] , $speed = 3)
    If _IsPressed('28') then MouseMove($pos[0], $pos[1]  + $distance, $speed = 3)
    If BitAND(_IsPressed('25'), _ISpressed('26')) then MouseMove($pos[0] - $distance, $pos[1] - $distance, $speed = 3)
    If BitAND(_IsPressed('26'), _ISpressed('27')) then MouseMove($pos[0] + $distance, $pos[1] - $distance, $speed = 3)
    If BitAND(_IsPressed('27'), _ISpressed('28')) then MouseMove($pos[0] + $distance, $pos[1] + $distance, $speed = 3)
    If BitAND(_IsPressed('28'), _ISpressed('25')) then MouseMove($pos[0] - $distance, $pos[1] + $distance, $speed = 3)
Wend
    
Func _MouseFree()
  Local $iRight, $iBottom
  $iLeft = 1
  $iTop = 1 
  $iWidth = @desktopWidth - 3 
  $iHeight = @desktopheight - 3
  $iRight = $iLeft + $iWidth
  $iBottom = $iTop + $iHeight
  If $iLeft < 0 Or $iTop < 0 Or $iRight > @DesktopWidth Or $iBottom > @DesktopHeight Then
     SetError (1)
     Return 0
  EndIf
  $aPos = MouseGetPos()
  Select
     Case $aPos[0] > $iRight
        MouseMove($iLeft, $aPos[1], 0)
     Case $aPos[0] < $iLeft
        MouseMove($iRight, $aPos[1], 0)
     Case $aPos[1] > $iBottom
        MouseMove($aPos[0], $iTop, 0)
     Case $aPos[1] < $iTop
        MouseMove($aPos[0], $iBottom, 0)
  EndSelect
EndFunc

Ctrl X exits

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Ummmm.... Did you put the rollover movements in there on purpose (ie. move mouse to the right and instead of stopping at edge it simply rolls over to the left [does this with arrow keys and mouse])? It's actually kinda cool, but gets annoying very fast if you're not used to it :P. Nice script though! Also, you need to add hotkeys (PgUp and PgDown have been used in previous scripts) for the right and left mouse buttons, enabling complete computer use without a mouse! Keep it up, so far you've came up with some pretty neat stuff man.

- Dan [Website]

Link to comment
Share on other sites

I would recommend Hotkeyset because it steals input and you dont have to worry about stuff using the UPs and Downs when u dont want them to and with your mousemoves the speed part you already defined it once you dont have to keep defining that $speed = 3

Edited by Thatsgreat2345
Link to comment
Share on other sites

I would recommend Hotkeyset because it steals input and you dont have to worry about stuff using the UPs and Downs when u dont want them to and with your mousemoves the speed part you already defined it once you dont have to keep defining that $speed = 3

might want to remove

$speed = 3 from the MouseMove() commands

Ok, this may sound stupid but it is seriously happening: Try taking away the '= 3' or just putting '3' in for all the speed part and it's doesn't work... I really have no idea why and if it just is my computer. But it is really puzzling....

EDIT: Nevermind... it's working even with just '$speed' even though I have no idea what I changed from last time :P

Ummmm.... Did you put the rollover movements in there on purpose (ie. move mouse to the right and instead of stopping at edge it simply rolls over to the left [does this with arrow keys and mouse])? It's actually kinda cool, but gets annoying very fast if you're not used to it wink.gif. Nice script though! Also, you need to add hotkeys (PgUp and PgDown have been used in previous scripts) for the right and left mouse buttons, enabling complete computer use without a mouse! Keep it up, so far you've came up with some pretty neat stuff man.

Lol, that was on purpose. I was thinking about adding clicks but couldn't think of any close keys to use, but pgup and pgdown sound good, I'll update the post once they're in.

EDIT: I tried using all 'HotKeySets' but it was way choppier...

Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...