Jump to content

quick question (can anyone answer?)


wenbo420
 Share

Recommended Posts

Hey guys

I just started using this program, I don't really know too much about it.

My main purpose for using this program was to make a script that allows me to move UP DOWN LEFT AND RIGHT by using the letters w s a d respectively.

my up and left and down right keys are damaged and I want to use these functions with the wasd keys.

I have been trying for bit but can't seem to figure out how to do it. Can anyone give me an idea on how I can do this?

Thanks so much

-T Zonday

Link to comment
Share on other sites

try this script...

HotKeySet("{ESC}", "Terminate")
HotKeySet("w", "up")
HotKeySet("a", "left")
HotKeySet("s", "down")
HotKeySet("d", "right")

While 1
    Sleep(100)
WEnd


Func Terminate()
    Exit 0
EndFunc

Func up()
    send("{up}")
EndFunc
Func down()
     send("{down}")
EndFunc
Func left()
     send("{left}")
EndFunc
Func right()
     send("{right}")
EndFunc
Link to comment
Share on other sites

here is a little longer one... just need to change from arrow keys to wasd

; ========================================================================
; Keyboard MouseMover
; 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("{F10}", "_Exit")

$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

8)

NEWHeader1.png

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...