scythetleppo Posted August 16, 2007 Posted August 16, 2007 Weird topic name but what I want to do is have a script which takes one file and appends it to another but LINE BY LINE, as shown below.file 1:i love i like that is afile 2:dogscatsgorillaand the finished file would be like this:i love dogsi like catsthat is a gorillaany idea how to do that?
PsaltyDS Posted August 16, 2007 Posted August 16, 2007 Weird topic name but what I want to do is have a script which takes one file and appends it to another but LINE BY LINE, as shown below. file 1: file 2: and the finished file would be like this: any idea how to do that? $avFile1 = _FileReadToArray($File_1) $avFile2 = _FileReadToArray($File_2) $hFile3 = FileOpen($File_3, 2) $x = $avFile1[0] If $avFile2[0] < $x Then $x = $avFile2[0] For $n = 1 To $x FileWriteLine($hFile3, $avFile1[$n] & " " & $avFile2[$n]) Next FileClose($hFile3) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
The Kandie Man Posted August 16, 2007 Posted August 16, 2007 Argh, did it but went afk for a minute. Psalty beat me. Here is what I did:#include <file.au3> Dim $as_File1, $as_File2 _FileReadToArray("file1.txt",$as_File1) _FileReadToArray("file2.txt",$as_File2) Dim $i_Count For $i_Count = 1 To UBound($as_File1)-1 $as_File1[$i_Count] &= " " & $as_File2[$i_Count] If $i_Count = Ubound($as_File2)-1 Then Exitloop Next _FileWriteFromArray("File3.txt",$as_File1,1) ShellExecute("File3.txt") Hope that helps. - The Kandie Man ;-) "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire
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