#include #include #include #include ;Run RClone Cache Mount on I: Global $iPID_RClone = Run(@ComSpec & " /k rclone.exe mount --vfs-cache-mode full --vfs-cache-max-age 0h1m0s --vfs-cache-poll-interval 1m0s --cache-db-purge --cache-writes --cache-workers 16 --allow-other --acd-templink-threshold 0 --stats 1s --buffer-size 1G --low-level-retries 3600000 --retries 3600000 --retries-sleep 1ms --timeout 5s --contimeout 5s --drive-acknowledge-abuse --drive-skip-gdocs -v gcache:/ I:", "", @SW_SHOW, $STDOUT_CHILD) OnAutoItExitRegister("_OnExit") AdlibRegister("_Rclone_Read") ;Main Idle loop While 1 Sleep(60000) WEnd ;This function gets ran when the script is exiting. Func _OnExit() ;Unmount RClone from System before exiting. WinClose("[CLASS:ConsoleWindowClass]") EndFunc ;==>_OnExit ;This function parses the Rclone window, providing stats about what it is currently doing. Func _Rclone_Parse() Local $sOutput = _Rclone_Read() EndFunc ;==>_Rclone_Parse Func _Rclone_Read() ;debug ConsoleWrite("Read Function Executed!" & @CRLF) ; Read current stream. Local $sOutput = StdoutRead($iPID_RClone) ; Errors when nothing to do. If @error Then ConsoleWrite("Read Failed! ERROR!" & @CRLF) ;Return EndIf ;debug ConsoleWrite("Bytes read: " & @extended & @CRLF) ;Transferred ConsoleWrite("Transferred1 Start!" & @CRLF) Local $aTransferred1 = StringRegExp($sOutput, "^Transferred:[\s]*([\w\d\.]+[\s]*\/[\s]*[\d\.]+[\s]*[\w\/]+),[\s]*([\d\.\%\-]+),[\s]*([\d\.]+[\s]*[\w\/]+),[\s]*[\w]+[\s]*[\w\d\-]+$", $STR_REGEXPARRAYMATCH) ;debug Switch @error Case 0 ConsoleWrite("Array is valid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) _ArrayDisplay($aTransferred1) Case 1 ConsoleWrite("Array is invalid. No matches." & @CRLF) Case 2 ConsoleWrite("Bad pattern, array is invalid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) EndSwitch ;Errors ConsoleWrite("Errors" & @CRLF) Local $aErrors = StringRegExp($sOutput, "^(Errors:)[\s]*([\d\.]+)", $STR_REGEXPARRAYMATCH) ;debug Switch @error Case 0 ConsoleWrite("Array is valid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) _ArrayDisplay($aErrors) Case 1 ConsoleWrite("Array is invalid. No matches." & @CRLF) Case 2 ConsoleWrite("Bad pattern, array is invalid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) EndSwitch ;Checks ConsoleWrite("Checks" & @CRLF) Local $aChecks = StringRegExp($sOutput, "^(Checks:)[\s]*([\d\.]+)[\s]*\/[\s]*([\d\.]+),[\s]*([\w\d\-]+)", $STR_REGEXPARRAYMATCH) ;debug Switch @error Case 0 ConsoleWrite("Array is valid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) _ArrayDisplay($aChecks) Case 1 ConsoleWrite("Array is invalid. No matches." & @CRLF) Case 2 ConsoleWrite("Bad pattern, array is invalid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) EndSwitch ;Transferred ConsoleWrite("Transferred2" & @CRLF) Local $aTransferred2 = StringRegExp($sOutput, "^(Transferred:)[\s]*([\d.]+)[\s]*\/[\s]*([\d.]+),[\s]*([\d\%\-]+)", $STR_REGEXPARRAYMATCH) ;debug Switch @error Case 0 ConsoleWrite("Array is valid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) _ArrayDisplay($aTransferred2) Case 1 ConsoleWrite("Array is invalid. No matches." & @CRLF) Case 2 ConsoleWrite("Bad pattern, array is invalid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) EndSwitch ;Elapsed Time ConsoleWrite("Elasped Time" & @CRLF) Local $aTime = StringRegExp($sOutput, "^(Elapsed time:)[\s]*([\w\d\.]+)", $STR_REGEXPARRAYMATCH) ;debug Switch @error Case 0 ConsoleWrite("Array is valid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) _ArrayDisplay($aTime) Case 1 ConsoleWrite("Array is invalid. No matches." & @CRLF) Case 2 ConsoleWrite("Bad pattern, array is invalid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) EndSwitch ;Files in Transfer ConsoleWrite("Files" & @CRLF) Local $aFiles = StringRegExp($sOutput, "^[\s\*]*([\s\w\d\!\@\#\$\%\^\&\(\)\-\=\_\+\/\`\~\'\;\,\.]+):[\s]*([\d\%]+)[\s]*\/[\s]*([\w\d\.]+),[\s]*([\w\d\.\/]+),[\s]*([\w\d]+)", $STR_REGEXPARRAYGLOBALMATCH) ;debug Switch @error Case 0 ConsoleWrite("Array is valid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) _ArrayDisplay($aFiles) Case 1 ConsoleWrite("Array is invalid. No matches." & @CRLF) Case 2 ConsoleWrite("Bad pattern, array is invalid." & @CRLF) ConsoleWrite("Offset: " & @extended & @CRLF) EndSwitch ;debug ConsoleWrite(@CRLF) ConsoleWrite(@CRLF) EndFunc ;==>_Rclone_Read