Jump to content

Small Udf


frontmill
 Share

Recommended Posts

it's a very small function but i thought maybe someone could use this... It is just like the normal mousemove function, but it also has the ability to move the mouse relatively

;Mousemove function with the possibility to move it relative.
;Use: MouseMove ( x, y [, speed [, flag ]] )
;Flag: 0 = move normal, 1 = move relative

Func movemouse( $a, $b,  $c, $d)  
$current = MouseGetPos ( )
Select
    case $d = 1
        $movetox = $current[0] + $a
        $movetoy = $current[1] + $b
        MouseMove($movetox, $movetoy, $c)   
    Case Else
        MouseMove($a, $b, $c)
EndSelect
EndFunc
Link to comment
Share on other sites

This could come in useful well done. I suggest you use _MouseMove as a fucntion name instead. Here is what i think makes it easy to use. note the last paramater is optional

;===============================================================================
;
; Function Name:   _MouseMove()
; Description:: same as MouseMove but can use relative movement
; Parameter(s): $x - X-coordinate, $y - Y-coordinate, $i_speed (0(instant)-100(slowest), $i_relative[optional] - use 1 for relative movement
; Requirement(s):  AutoIt
; Return Value(s): None
; Author(s):       frontmill
;
;===============================================================================
;
;Example
For $i = 1 To 10
    If $i = 1 Then _MouseMove(0,0,0)
    _MouseMove(20, 20, 0, 1)
    Sleep(1000)
Next

Func _MouseMove($x, $y, $i_speed, $i_relative = 0)  
$current = MouseGetPos()
    Select
        case $i_relative = 1
            $movetox = $current[0] + $x
            $movetoy = $current[1] + $y
            MouseMove($movetox, $movetoy, $i_speed) 
        Case Else
            MouseMove($x, $y, $i_speed)
    EndSelect
EndFunc
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

How about we just do this:

;===============================================================================
;
; Function Name:    _MouseMoveRel()
; Description::     Moves the Mouse Relative to current mouse position
; Parameter(s):     $x - change in x position
;                     $y - change in y position 
;                     $i_speed (0(instant)-100(slowest)
; Requirement(s):     AutoIt
; Return Value(s):  None
; Author(s):        frontmill w/ contributions from RazorM and Cyber_Author (xwinterx)
;
;===============================================================================
Func _MouseMoveRel($x, $y, $i_speed)  
    $current = MouseGetPos()
    $movetox = $current[0] + $x
    $movetoy = $current[1] + $y
    MouseMove($movetox, $movetoy, $i_speed)
EndFunc

No need to have a flag for normal or relative since we already have the built-in mousemove with autoit. How would this work?

Notice the comment change in the Parameters. I used "change in position" because that is what that variable is for, not a X or Y position. I was slightly confused before I looked at it better.

Link to comment
Share on other sites

should do something like

_MouseMoveRel(100,100,0,100)

Func _MouseMoveRel($x, $y, $i_speed, $times)  
    For $i = 1 to $times
    $current = MouseGetPos()
    $movetox = $current[0] + $x
    $movetoy = $current[1] + $y
    MouseMove($movetox, $movetoy, $i_speed)
Next
EndFunc

make it so u choose how many times to do it :) idk just bored

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