kor Posted April 6, 2010 Share Posted April 6, 2010 expandcollapse popup#Include <File.au3> #Include <Array.au3> $Path = @ScriptDir $Folders=_FileListToArray($Path, '*', 2) $company = InputBox("Robocopy Maker", "Company Name?", "", " M") $drive_pre = InputBox("Robocopy Maker", "Destination Drive Letter?", "", " M1") $destinationdrive = StringUpper($drive_pre) $File = $company & ".bat" ; Remove drive letter from Path $workingpath = StringTrimLeft($Path, 1) ; Combine to form new destination directory $destinationpath = $destinationdrive & $workingpath ; Error checking If @Error=1 Then MsgBox (0,"Error","No Files\Folders Found.") Exit EndIf ; Trim folder count from array $count = "0" _ArrayDelete($Folders, $count) ;_ArrayDisplay($Folders) ; Pre and Post commands $pre = "start robocopy " $post = " /E /DCOPY:T" For $i = 0 to UBound($Folders) -1 $Folders[$i] = $pre & '"' & $Path & "\" & $Folders[$i] & '" "' & $destinationpath & "\" & $Folders[$i] & '"' & $post Next _FileWriteFromArray($File, $Folders) ; Display results Run("notepad.exe " & $File) I am wanting to read the $workingpath as a string and if the path contains a "%" character anywhere in the path, then I want to do a stringreplace and change the single % into a double %% (weird robocopy issue that needs two %'s to actually pass a % as a character and not a variable) I am wondering how I can read and modify the string while it is working inside the arrays. I don't really understand arrays too well. Link to comment Share on other sites More sharing options...
darkjohn20 Posted April 6, 2010 Share Posted April 6, 2010 If StringInStr($workingpath, "%") Then $workingpath = StringReplace($workingpath, "%", "%%") I haven't tested it, but it should work. 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