Sign in to follow this  
Followers 0
emoyasha

KeyBoard as Mouse

9 posts in this topic

Hey i edited someone elses script, i dunno who it was that made the originaal, but if you did so please tell me.

anyone i turned the script into a fully function keyboard mouse script, as right now i have no mouse, i needed something to, ehhhh act as a mouse, because using the keyboard is driving me crazy.

of course im going to get a new mouse tomorow, but this works great, allows moving of mouse, left and right click, dragging, and scrolling up and down.

; Build version 1.3
; Created by: Monamo
; Questions or comments can be directed to me on the AutoIt support forums
; ========================================================================


#include<Misc.au3>
HotKeySet("{INS}", "_ShowInfo")
HotKeySet("+{UP}", "_UpArrow")
HotKeySet("{UP}", "_UpArrow")
HotKeySet("+{DOWN}", "_DownArrow")
HotKeySet("{DOWN}", "_DownArrow")
HotKeySet("+{LEFT}", "_LeftArrow")
HotKeySet("{LEFT}", "_LeftArrow")
HotKeySet("+{RIGHT}", "_RightArrow")
HotKeySet("{RIGHT}", "_RightArrow")
HotKeySet("+{HOME}", "_drag")
HotKeySet("+{END}", "_dragup")
HotKeySet("{HOME}", "_click")
HotKeySet("{END}", "_clickl")
HotKeySet("{F10}", "_Exit")
HotKeySet("{F6}", "_scroll")
HotKeySet("{F7}", "_scrolldown")

$MouseModifier = 1
$PressedTime = 1

While 1
    If (_IsPressed(25) + _IsPressed(26) + _IsPressed(27) + _IsPressed(28)) = 0 Then
        _ResetSpeed()
    EndIf
    Sleep(100)
WEnd

Func _ShowInfo()
    Local $MousePos = MouseGetPos()
    $PixColor = PixelGetColor($MousePos[0], $MousePos[1])
    MsgBox(0, "Color Information", "Color information at selected mouse position(x,y): " & $MousePos[0] & "," & $MousePos[1] & @CR & @CR & "Hex color value: " & "0x" & Hex($PixColor, 6))
EndFunc   ;==>_ShowInfo

Func _UpArrow()
    Local $MousePos = MouseGetPos()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf
   
    If $MousePos[1] > 0 Then
        _BoostMouseSpeed()
        MouseMove($MousePos[0], $MousePos[1] - ($MouseModifier * $i), 1)
    EndIf
EndFunc   ;==>_UpArrow

Func _DownArrow()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf

    Local $MousePos = MouseGetPos()
    If $MousePos[1] < @DesktopHeight Then
        _BoostMouseSpeed()
        MouseMove($MousePos[0], $MousePos[1] + ($MouseModifier * $i),1)
    EndIf
EndFunc   ;==>_DownArrow

Func _LeftArrow()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf

    Local $MousePos = MouseGetPos()
    If $MousePos[0] > 0 Then
        _BoostMouseSpeed()
        MouseMove($MousePos[0] - ($MouseModifier * $i), $MousePos[1],1)
    EndIf
EndFunc   ;==>_LeftArrow

Func _RightArrow()
    If _IsPressed(10) Then
        $i = 10
    Else
        $i = 1
    EndIf

    Local $MousePos = MouseGetPos()
    If $MousePos[0] < @DesktopWidth Then
        _BoostMouseSpeed()
        MouseMove($MousePos[0] + ($MouseModifier * $i), $MousePos[1],1)
    EndIf
EndFunc   ;==>_RightArrow

Func _BoostMouseSpeed()
        If IsInt($PressedTime / 10) Then
            $MouseModifier = $MouseModifier + 1
            $PressedTime = $PressedTime + 1
        Else
            $PressedTime = $PressedTime + 1
        EndIf
EndFunc

Func _ResetSpeed()
    $MouseModifier = 1
    $PressedTime = 1
EndFunc   ;==>_ResetSpeed

Func _Exit()
    Exit
EndFunc   ;==>_Exit



Func _click()
    mouseclick("left")
EndFunc
Func _clickl()
    MouseClick("right")
EndFunc 
Func _drag()
    MouseDown("left")
EndFunc
func _dragup()
    mouseup("left")
EndFunc
func _scroll()
    MouseWheel("up")
EndFunc
func _scrolldown()
    MouseWheel("down")
EndFunc

Admin Of:http://notmyspace.info [Under Development, looking for volunteers to help improve]http://PSNetCards.co.ukhttp://ZacnAndLindsey.com [Under development, not quite sure what to do with it yet]http://revelm.com------------------------------------Radio Streams:http://75.185.53.88:8000 [128kb/s 44kHz]http://75.185.53.88:8002 [22kb/s 22kHz](works on mobile phones)-----------------------------------My Server:Owned By: http://jumpline.comIP:66.84.19.220Bandwidth:200GBStorage Space:1TBNetwork Connection: 1GB/S[up and down]Operating System: Red Hat LinuxInstalled Apps:Webmail, phpBB, Majordomo, phpMyAdmin, MySQL, Active Server Pages, FrontPage Extensions 2002, GraphicsMagick, Mod Perl, Perl, PHP: Hypertext Preprocessor, Python(want cheap good webhosting, or need a place to park your domain? contact me)-----------------------------------

Share this post


Link to post
Share on other sites



uhm .... try your script and it tastes good, but isn't there somethings to increase (decrease) the speed ?, like press the up arrow key with Ctrl ?

i made ones, a little simple script, don't want to hijack your thread but it's only a demo

;-------------------
;Cursor Controller
;Author : d4rk
;Finish : 20/3/2008 1:20PM
;-------------------
#NoTrayIcon
#include <Misc.au3>
HotKeySet("{F1}","help")
Func help()
    msgbox(64,"How To Use ...","1 .Use Left/Right/Up/Down Arrow To Move Cursor" & @CR & "2 .Hold [Ctrl] While Pressing Them Help Increasing Speed, Hold [Winkey] While Pressing Them Help Decrease The Speed" & @CR & "3 .[+] And [-] Will Be Useful In Window Which Has ScrollBar, They Can Be Also Used With [Ctrl] And [Winkey]" & @CR & "4 .Press [Delete] To Pause Program Or Re-Active It" & @CR & "5 .Recomment : You Should [Pause] Program While [Typing Text] To Web Page Or Apps" & @CR & @CR & "[d4rk - Le Khuong Duy]")
EndFunc

;---------------
;PAUSE MODE
;---------------
Global $Paused

HotKeySet("{delete}","pause")
Func pause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
    WEnd

EndFunc
;---------------
;END OF PAUSE MODE
;---------------

while 1
$left="25"
$right="27"
$up="26"
$down="28"
$pos = MouseGetPos()
$X=$pos[0] 
$Y=$pos[1]

;------------------------------------------------
;Select of Ctrl : Bigger Distance
;------------------------------------------------
while _IsPressed("11");press Ctrl = bigger distance
$ndis="50"
select
    
case _IsPressed($left)
    ;msgbox(64,"","left")
    $X=$X-$ndis
    MouseMove($X,$Y,3)
    
case _IsPressed($right)
    ;msgbox(64,"","right")
    $X=$X+$ndis
    MouseMove($X,$Y,3)

case _IsPressed($up)
    ;msgbox(64,"","up")
    $Y=$Y-$ndis
    MouseMove($X,$Y,3)
    
case _IsPressed($down)
    ;msgbox(64,"","down")
    $Y=$Y+$ndis
    MouseMove($X,$Y,3)
    
case _IsPressed("BB");+ = up
    ;msgbox(64,"","")
    $Y=$Y-$ndis
    MouseMove($X,$Y,3)
    
case _IsPressed("BD");- = down
    ;msgbox(64,"","")
    $Y=$Y+$ndis
    MouseMove($X,$Y,3)
EndSelect
WEnd

;------------------------------------------------
;End Select of Ctrl : Bigger Distance
;------------------------------------------------



;------------------------------------------------
;Select of Winkey <left or right> : Smaller Distance
;------------------------------------------------
while _IsPressed("5B") or _IsPressed("5C");press winkey [left or right] = smaller distance
$ndis="5"
select
case _IsPressed($left)
    ;msgbox(64,"","left")
    $X=$X-$ndis
    MouseMove($X,$Y,3)
    
case _IsPressed($right)
    ;msgbox(64,"","right")
    $X=$X+$ndis
    MouseMove($X,$Y,3)
        
case _IsPressed($up)
    ;msgbox(64,"","up")
    $Y=$Y-$ndis
    MouseMove($X,$Y,3)

case _IsPressed($down)
    ;msgbox(64,"","down")
    $Y=$Y+$ndis
    MouseMove($X,$Y,3)

case _IsPressed("BB");+ = up
    ;msgbox(64,"","")
    $Y=$Y-$ndis
    MouseMove($X,$Y,3)
    
case _IsPressed("BD");- = down
    ;msgbox(64,"","")
    $Y=$Y+$ndis
    MouseMove($X,$Y,3)
EndSelect
WEnd

;------------------------------------------------
;End Select of Alt <left or right> : Smaller Distance
;------------------------------------------------



;------------------------------------------------
;Select of Normal <No Ctrl , Winkey Pressed>
;------------------------------------------------

$ndis="20";normal distance
Select
case _IsPressed($left)
    ;msgbox(64,"","left")
    $X=$X-$ndis
    MouseMove($X,$Y,3)

case _IsPressed($right)
    ;msgbox(64,"","right")
    $X=$X+$ndis
    MouseMove($X,$Y,3)

case _IsPressed($up)
    ;msgbox(64,"","up")
    $Y=$Y-$ndis
    MouseMove($X,$Y,3)

case _IsPressed($down)
    ;msgbox(64,"","down")
    $Y=$Y+$ndis
    MouseMove($X,$Y,3)

case _IsPressed("BB");+ = up
    ;msgbox(64,"","")
    $Y=$Y-$ndis
    MouseMove($X,$Y,3)

case _IsPressed("BD");- = down
    ;msgbox(64,"","")
    $Y=$Y+$ndis
    MouseMove($X,$Y,3)
EndSelect
;------------------------------------------------
;EndSelect of Normal <No Ctrl, Winkey Pressed>
;------------------------------------------------

;for the left click by Shift
if _IsPressed("10") Then
    MouseClick("left")
EndIf
WEnd

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites

yes it moves faster the longer you hold down movement buttons, i still have no mouse and im trying to use photoshop......


Admin Of:http://notmyspace.info [Under Development, looking for volunteers to help improve]http://PSNetCards.co.ukhttp://ZacnAndLindsey.com [Under development, not quite sure what to do with it yet]http://revelm.com------------------------------------Radio Streams:http://75.185.53.88:8000 [128kb/s 44kHz]http://75.185.53.88:8002 [22kb/s 22kHz](works on mobile phones)-----------------------------------My Server:Owned By: http://jumpline.comIP:66.84.19.220Bandwidth:200GBStorage Space:1TBNetwork Connection: 1GB/S[up and down]Operating System: Red Hat LinuxInstalled Apps:Webmail, phpBB, Majordomo, phpMyAdmin, MySQL, Active Server Pages, FrontPage Extensions 2002, GraphicsMagick, Mod Perl, Perl, PHP: Hypertext Preprocessor, Python(want cheap good webhosting, or need a place to park your domain? contact me)-----------------------------------

Share this post


Link to post
Share on other sites

Hey i edited someone elses script, i dunno who it was that made the originaal, but if you did so please tell me.

Did you ever bother to read the comments in the code you edited? muttley

; Build version 1.3
; Created by: Monamo
; Questions or comments can be directed to me on the AutoIt support forums
; ========================================================================

http://www.autoitscript.com/forum/index.ph...c=53262&hl=

Share this post


Link to post
Share on other sites

i didnt see that till few minutes ago, and seeing as i have no mouse i couldnt be bothered to fix while im using photoshop/


Admin Of:http://notmyspace.info [Under Development, looking for volunteers to help improve]http://PSNetCards.co.ukhttp://ZacnAndLindsey.com [Under development, not quite sure what to do with it yet]http://revelm.com------------------------------------Radio Streams:http://75.185.53.88:8000 [128kb/s 44kHz]http://75.185.53.88:8002 [22kb/s 22kHz](works on mobile phones)-----------------------------------My Server:Owned By: http://jumpline.comIP:66.84.19.220Bandwidth:200GBStorage Space:1TBNetwork Connection: 1GB/S[up and down]Operating System: Red Hat LinuxInstalled Apps:Webmail, phpBB, Majordomo, phpMyAdmin, MySQL, Active Server Pages, FrontPage Extensions 2002, GraphicsMagick, Mod Perl, Perl, PHP: Hypertext Preprocessor, Python(want cheap good webhosting, or need a place to park your domain? contact me)-----------------------------------

Share this post


Link to post
Share on other sites

It`s ok emoyasha, your script is good and you can use it for Photoshop. muttley


When the words fail... music speaks

Share this post


Link to post
Share on other sites

I made one called, MouseyKey.

Just tested, it`s like MouseKey from Control Panel ->> Accessibility, only speed is different.

When the words fail... music speaks

Share this post


Link to post
Share on other sites

*rejoice* bought a mouse, YAY/


Admin Of:http://notmyspace.info [Under Development, looking for volunteers to help improve]http://PSNetCards.co.ukhttp://ZacnAndLindsey.com [Under development, not quite sure what to do with it yet]http://revelm.com------------------------------------Radio Streams:http://75.185.53.88:8000 [128kb/s 44kHz]http://75.185.53.88:8002 [22kb/s 22kHz](works on mobile phones)-----------------------------------My Server:Owned By: http://jumpline.comIP:66.84.19.220Bandwidth:200GBStorage Space:1TBNetwork Connection: 1GB/S[up and down]Operating System: Red Hat LinuxInstalled Apps:Webmail, phpBB, Majordomo, phpMyAdmin, MySQL, Active Server Pages, FrontPage Extensions 2002, GraphicsMagick, Mod Perl, Perl, PHP: Hypertext Preprocessor, Python(want cheap good webhosting, or need a place to park your domain? contact me)-----------------------------------

Share this post


Link to post
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
Sign in to follow this  
Followers 0