Jump to content

au3record: How to change default speed of MouseMove?


Go to solution Solved by Jfish,

Recommended Posts

  • Developers
Posted (edited)

Try F1 in the editor to open the helpfile and learn how to change the delays. ;) 
ps: au3record isn't supported anymore for quite a while and really considered as a tool not to use, but rather we encourage to make some smarter code.
 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Can't find how to change default speed which is 10. I don't wanna manually change 100 lines of MouseMove to 5 speed.

I'm not a coder, I just want an easy to use mouse recorder. This is the first one I tried and is easy to use

Link to post
Share on other sites

So since you are struggling with what Jos suggested, I wrote this script for you that you can use to process your script that was created with Au3Rercord.  It allows you to specify the speed and it will alter the file you create to whatever speed you want.

; mousemove script scrubber
#include<Array.au3>
$speed=6 ; set this to whatever speed you want

global $file= FileOpen(@desktopdir&"/au3record.au3"); open file (this is the location where you save you au3Record file)
if @error then ; check for errors
    MsgBox(0,'error',@error)
EndIf

func _changeSpeed($file)
$contents= fileread($file); gather contents of file
FileClose($file); close file
$stringArray=StringSplit($contents,@cr) ; this pulls the contents into an array
for $a=0 to UBound($stringArray)-1 ; this iterates through the array, looks for mouse move, and sets the speed
    ;ConsoleWrite($a)
    if _ArraySearch($stringArray,"MouseMove",$a,$a,0,1)<>-1 then
        ;MsgBox(0,'','hit')
        $stringArray[$a]=StringTrimRight($stringArray[$a],1)&","&$speed&")"
    EndIf
Next
_ArrayDelete($stringArray,0); deletes initial value of array that is from the string split
_ArrayDisplay($stringArray) ; optionally shows you the results of the new array
$newString=_ArrayToString($stringArray) ; optionally creates a new string you can save as a new AU3 file to replace the one above
MsgBox(0,'',$newString); optionally shows that new script you can save to a file in a message box
EndFunc
_changeSpeed($file) ; runs the function

 

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Link to post
Share on other sites

That was a default delimiter in the _arraytostring function.  Passing blanks for those parameters resolves it:

; mousemove script scrubber
#include<Array.au3>
$speed=6 ; set this to whatever speed you want

global $file= FileOpen(@desktopdir&"/au3record.au3"); open file (this is the location where you save you au3Record file)
if @error then ; check for errors
    MsgBox(0,'error',@error)
EndIf

func _changeSpeed($file)
$contents= fileread($file); gather contents of file
FileClose($file); close file
$stringArray=StringSplit($contents,@cr) ; this pulls the contents into an array
for $a=0 to UBound($stringArray)-1 ; this iterates through the array, looks for mouse move, and sets the speed
    ;ConsoleWrite($a)
    if _ArraySearch($stringArray,"MouseMove",$a,$a,0,1)<>-1 then
        ;MsgBox(0,'','hit')
        $stringArray[$a]=StringTrimRight($stringArray[$a],1)&","&$speed&")"

    EndIf
Next
_ArrayDelete($stringArray,0); deletes initial value of array that is from the string split
_ArrayDisplay($stringArray) ; optionally shows you the results of the new array
$newString=_ArrayToString($stringArray,"","") ; remove pipes + optionally creates a new string you can save as a new AU3 file to replace the one above
MsgBox(0,'',$newString); optionally shows that new script you can save to a file in a message box
EndFunc
_changeSpeed($file) ; runs the function

 

Edited by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Link to post
Share on other sites

yay. Thanks :D But now it adds this at the beginning 

---------------------------

---------------------------
 and this at the end

---------------------------
OK   
---------------------------
which gives the same error but I can just delete those 

Link to post
Share on other sites
  • Solution

I am not sure what you are doing after you create the new string (i.e. after my function ended) but I am not seeing those lines when I save it down to a file.  I am including some code to demonstrate. Note the new bit at the end of the function that now saves it as a new file.  You can put it wherever and rename it if you like. However, when you compare the original from Au3Record with the new one the only difference should be the delays that were added.

; mousemove script scrubber
#include<Array.au3>
$speed=6 ; set this to whatever speed you want

global $file= FileOpen(@desktopdir&"/au3test.au3"); open file (this is the location where you save you au3Record file)
if @error then ; check for errors
    MsgBox(0,'error',@error)
EndIf

func _changeSpeed($file)
$contents= fileread($file); gather contents of file
FileClose($file); close file
$stringArray=StringSplit($contents,@cr) ; this pulls the contents into an array
for $a=0 to UBound($stringArray)-1 ; this iterates through the array, looks for mouse move, and sets the speed
    ;ConsoleWrite($a)
    if _ArraySearch($stringArray,"MouseMove",$a,$a,0,1)<>-1 then
        ;MsgBox(0,'','hit')
        $stringArray[$a]=StringTrimRight($stringArray[$a],1)&","&$speed&")"

    EndIf
Next
_ArrayDelete($stringArray,0); deletes initial value of array that is from the string split
_ArrayDisplay($stringArray) ; optionally shows you the results of the new array
$newString=_ArrayToString($stringArray,"","") ; remove pipes + optionally creates a new string you can save as a new AU3 file to replace the one above
MsgBox(0,'',$newString); optionally shows that new script you can save to a file in a message box
$newFile=FileOpen(@DesktopDir&"/newAU3record.au3",2) ; CREATES A NEW FILE - PUT WHERE YOU WANT
FileWrite($newFile,$newString) ; writes contents of new string with delays to file
FileClose($newFile); closes flile
EndFunc
_changeSpeed($file) ; runs the function

 

Edited by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Link to post
Share on other sites

Untitled.thumb.png.d0a9466bede5e8954c2255cba09cb2d7.png

It's because when I use the code from your first 2 posts nothing happens after I close this thing. It doesn't save it as a new file. So I copy and paste it. That's when the lines ------- appear.

 

With the code from your 3rd post it creates a new file after I close this and that file has no ------ lines. 

 

Thank you very much for the script :D

Edited by uhhuy055
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...