Macen Posted December 6, 2010 Share Posted December 6, 2010 Hi I have writen a robocopy script and AutoIT script to show the detailes of the copy. robolog RunWait(@ComSpec & ' /C ' & "c:\robocopy\RobocopyScript.cmd") $FilePath = "C:\robocopy\logs\robocopylog.txt" $sRead = FileRead($FilePath) $7Lines = StringTrimLeft($sRead, StringInStr($sRead, @CRLF, "", -7)+1) MsgBox(0, "Backup of My documents:", "Backup Status:" & @LF & @LF & " Total Copied Skipped Mismatch FAILED Extras" & @LF & $7Lines & @LF & @LF & "Message: Verfied that files are copied") robocopyscript.cmd robocopy "C:\copytest" "C:\copytest2" /MIR /V /NP /LOG:c:\robocopy\logs\robocopylog.txt /R:15 /W:53 Rbocopy Log ------------------------------------------------------------------------------ Total Copied Skipped Mismatch FAILED Extras Dirs : 17 0 17 0 0 0 Files : 358 0 358 0 0 0 Bytes : 147.82 m 0 147.82 m 0 0 0 Times : 0:00:01 0:00:00 0:00:00 0:00:01 Ended : Mon Dec 06 10:30:40 2010 As you see in dialog box that the numbers is not correct aligned with the category. Is there some way to fix this?! Or maybe somebody got a smarter way to build it? This is my first script, and yes it’s a bit messy Link to comment Share on other sites More sharing options...
Tvern Posted December 6, 2010 Share Posted December 6, 2010 Here is a quick way to line stuff out using @TAB. You could also try making a simple GUI and use something like a ListView to display the data. Local $data = "Total Copied Skipped Mismatch FAILED Extras" & @CRLF _ & "Dirs : 17 0 17 0 0 0" & @CRLF _ & "Files : 358 0 358 0 0 0" & @CRLF _ & "Bytes : 147.82 m 0 147.82 m 0 0 0" & @CRLF _ & "Times : 0:00:01 0:00:00 0:00:00 0:00:01" & @CRLF & @CRLF _ & "Ended : Mon Dec 06 10:30:40 2010" $data = StringReplace($data," m","m",0,1) $data = StringReplace($data," :",":") $data = @TAB & StringReplace($data," ",@TAB) MsgBox(0,"test",$data) Link to comment Share on other sites More sharing options...
Macen Posted December 8, 2010 Author Share Posted December 8, 2010 Thanks Tvern RunWait(@ComSpec & ' /C ' & "c:\robocopy\RobocopyScript.cmd") $FilePath = "C:\robocopy\logs\robocopylog.txt" $sRead = FileRead($FilePath) $7Lines = StringTrimLeft($sRead, StringInStr($sRead, @CRLF, "", -8)+1) $7Lines = StringReplace($7Lines," m","m",0,1) $7Lines = StringReplace($7Lines," :",":") $7Lines = StringReplace($7Lines," ","_") $7Lines = StringReplace($7Lines,"__","_") $7Lines = StringReplace($7Lines,"__","_") $7Lines = StringReplace($7Lines,"__","_") $7Lines = StringReplace($7Lines,"__","_") $7Lines = StringReplace($7Lines,"__","_") $7Lines = StringReplace($7Lines,"__","_") $7Lines = StringReplace($7Lines,"__","_") $7Lines = StringReplace($7Lines,"__","_") $7Lines = StringReplace($7Lines,"__","_") $7Lines = @TAB & StringReplace($7Lines,"_",@TAB) MsgBox(0,"Backupstatus",@TAB & "Folder Syncronization status report:" & @CRLF & @TAB & "-------------------------------------------------------------------------" & @CRLF & $7Lines) Link to comment Share on other sites More sharing options...
Tvern Posted December 8, 2010 Share Posted December 8, 2010 Looks like you're trying to get rid of multiple white spaces. You could probably do it in less lines with StringRegExpReplace, or StringStripWS. I think StringRegExpReplace is more likely to give the right result, but it's easier for StringStripWS to make an example. Here's an untested suggestion. RunWait(@ComSpec & ' /C ' & "c:\robocopy\RobocopyScript.cmd") $FilePath = "C:\robocopy\logs\robocopylog.txt" $sRead = FileRead($FilePath) $7Lines = StringTrimLeft($sRead, StringInStr($sRead, @CRLF, "", -8)+1) $7Lines = StringReplace($7Lines," m","m",0,1) $7Lines = StringReplace($7Lines," :",":") $7Lines = StringStripWS($7Lines,4) ;strips multiple white space $7Lines = @TAB & StringReplace($7Lines," ",@TAB) Of coarse if your script works you can just leave it at that. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now