froufrou Posted June 8, 2009 Share Posted June 8, 2009 OK.Here is a small piece of code.If you need more code just ask,i thought this might be enough. What I am wanting to do is for each line read is to rewrite it later in script. What it's doing is reading file and folder paths from .txt file and i want to insert those paths into places later down the script.Because this script will output a .vbs . So how do i get each read line which is "$folder" and place it at "$folder" position in the .vbs output. Thank in advance for any help While 1 $folder = FileReadLine($poo) If @error = -1 Then ExitLoop WEnd _VBS() Func _VBS() Local $vbs $vbs = "Option Explicit"& @CRLF _ &"Dir.AddTree "&'"'&$folder&'"'&", true"& @CRLF _ FileWrite(@TempDir & "\burn.vbs", $vbs) RunWait(@ComSpec & " /c " & 'cscript.exe //E:VBScript '&@TempDir & "\burn.vbs",@SystemDir) FileDelete(@TempDir & "\burn.vbs") EndFunc Link to comment Share on other sites More sharing options...
Zedna Posted June 8, 2009 Share Posted June 8, 2009 (edited) Maybe I didn't get point :-) Global $vbs While 1 $folder = FileReadLine($poo) If @error = -1 Then ExitLoop $vbs &= "Option Explicit" & @CRLF _ & "Dir.AddTree " & '"' & $folder & '"' & ", true" & @CRLF ; ? WEnd _VBS() Func _VBS() FileWrite(@TempDir & "\burn.vbs", $vbs) RunWait(@ComSpec & " /c " & 'cscript.exe //E:VBScript ' & @TempDir & "\burn.vbs", @SystemDir) FileDelete(@TempDir & "\burn.vbs") EndFunc ;==>_VBS Edited June 8, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
froufrou Posted June 8, 2009 Author Share Posted June 8, 2009 @Zedna Thanks for the quick reply.i should try again.The .vbs script is mush longer than what i put and i actually put a line in the example that shouldn't have been.Take a look at this and see if you can help me.And if i run what is below i get lots of errors.And i know its not what you put ,but i just realized i had put wrong line in first post. Thanks Again Global $vbs While 1 $folder = FileReadLine($poo) If @error = -1 Then ExitLoop $vbs = "Dir.AddTree " & '"' & $folder & '"' & ", true" & @CRLF ;<this is the line i will be adding to the .vbs and will be adding it many times according to .txt file WEnd _VBS() Func _VBS() FileWrite(@TempDir & "\burn.vbs", $vbs) RunWait(@ComSpec & " /c " & 'cscript.exe //E:VBScript ' & @TempDir & "\burn.vbs", @SystemDir) FileDelete(@TempDir & "\burn.vbs") EndFunc ;==>_VBS Link to comment Share on other sites More sharing options...
Zedna Posted June 8, 2009 Share Posted June 8, 2009 $vbs = "Dir.AddTree " & '"' & $folder & '"' & ", true" & @CRLF must be $vbs &= "Dir.AddTree " & '"' & $folder & '"' & ", true" & @CRLF Resources UDF ResourcesEx UDF AutoIt Forum Search 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