Dirkaios

path_creator.au3

Jul 18th, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.17 KB | None | 0 0
  1. #include <Misc.au3>
  2. Local $hDLL = DllOpen("user32.dll")
  3. HotKeySet("{F3}", "Terminate")
  4.  
  5.  
  6. Func Terminate()
  7.     StopRecordPath()
  8.     Exit 0
  9. EndFunc
  10.  
  11. Func main()
  12.     Global $timesleep = InputBox("Record mouse movement each X ms","Record each x Miliseconds. Hold middle mouse btn to keep recording. Release to stop. F3 will save and exit.",100)
  13.     if @error = 1 then Exit
  14.     Global $file = FileOpen("MyPath.au3", 2)
  15.     If $file = -1 Then
  16.         MsgBox(0, "Error", "Unable to open file.")
  17.         Exit
  18.     EndIf
  19.     FileWrite($file, "func MyPath()" & @CRLF)
  20.     FileWriteLine($file, 'MouseDown("middle")')
  21.     while 1
  22.         while _IsPressed(04,$hDLL)
  23.                 RecordPath()
  24.             WEnd
  25.         WEnd
  26. EndFunc
  27.  
  28. Func RecordPath()
  29.         $grava = MouseGetPos()
  30.         Sleep($timesleep)
  31.         FileWriteLine($file, 'MouseMove('& $grava[0] & ' + Random(1,3),' & $grava[1] & ' + Random(1,3),1)')
  32.         FileWriteLine($file, 'Sleep(' & $timesleep & ')')
  33. ;~      FileWriteLine($file, 'Sleep(' & $timesleep & ' + Random(1,3))')
  34. EndFunc
  35.  
  36. Func StopRecordPath()
  37.     FileWriteLine($file, 'MouseUp("middle")')
  38.     FileWrite($file, "endfunc" & @CRLF)
  39.     FileWrite($file, "sleep(7000)" & @CRLF)
  40.     FileWrite($file, "MyPath()" & @CRLF)
  41.     FileClose($file)
  42. EndFunc
  43.  
  44. main()
Advertisement
Add Comment
Please, Sign In to add comment