We start out by defining a constant (ForReading) that we’ll use to open each log file. Set objTextFile = objFSO.OpenTextFile(“c:\logs\file2.log “, ForReading)Īs you can see, this isn’t exactly rocket science. Set objTextFile = objFSO.OpenTextFile(“c:\logs\file1.log”, ForReading)
![combining chapter files into one document microsoft word for mac 2011 combining chapter files into one document microsoft word for mac 2011](https://i.ytimg.com/vi/g5ODJrMDzlo/maxresdefault.jpg)
Set objOutputFile = objFSO.CreateTextFile(“output.txt”) Set objFSO = CreateObject(“Scripting.FileSystemObject”) In fact, we’ll have to use a script that looks a lot like this: Const ForReading = 1 For example, to combine File1.log and File2.log into a single file (which we’ll call Output.txt) we’ll have to first read File1.log and append the contents of that file to output.txt, then we’ll have to read File2.log and append the contents of that file to Output.txt. That’s a shame, but it won’t stop us from combining text files we’ll just have to go through a few extra steps in order to do this. The problem we face is that neither WSH nor VBScript has a way to combine text files with a single command (e.g., objFile.AddTextFiles(“file1.log”,”file2.log”). We have to do it in a slightly cumbersome way, but it’ll work just fine. Can we use a script to combine text files? Yes we can.
![combining chapter files into one document microsoft word for mac 2011 combining chapter files into one document microsoft word for mac 2011](https://clipground.com/images/how-to-combine-clipart-in-word-15.png)
We told you that the solution wasn’t very elegant, but that it would do the job. In yesterday’s column we dealt with text files more specifically, we talked about how you can use a script to modify. Hey, Scripting Guy! From the command prompt the command copy a.txt+b.txt ab.txt will take the contents of a.txt and the contents of b.txt and combine them into a new file named ab.txt.