Kiko745 Posted November 27, 2019 Posted November 27, 2019 Hello! I am new to autoit so please if someone could help me. I am trying to combine multiple .txt files but I can't get it right. In every file are the exact amout of lines ( for example here are 2 ) , I don't want to make it for just 2 lines for each txt files but for all the lines the txt files contains. The thing I want to do is : Text File 1 Hello my name I am a big ... Text File 2 is Fred, Potato head for ... Text File 3 and I like to eat pizza. Not getting this right. ... ------------------- Combine them all into one txt file like here ------------------------------ Final Text file Hello my name is Fred, and I like to eat pizza. I am a big Potato head for Not getting this right. ... Thanks for any advice! P.S. Sorry for my English, not my first language.
Nine Posted November 27, 2019 Posted November 27, 2019 Look at _FileReadToArray. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Kiko745 Posted November 27, 2019 Author Posted November 27, 2019 @Nine I've tried, the closest I got was that i merged all 3 but it was pasted every time under the lines, not behind them.
Nine Posted November 27, 2019 Posted November 27, 2019 Show your code, we will check on it... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Kiko745 Posted November 29, 2019 Author Posted November 29, 2019 Nvm got it! #include <File.au3> #include <MsgBoxConstants.au3> Global $file1 = "C:\Users\Malach\Desktop\Script\start.txt" Global $file2 = "C:\Users\Malach\Desktop\Script\mid.txt" Global $file3 = "C:\Users\Malach\Desktop\Script\end.txt" Global $filefinal = "C:\Users\Malach\Desktop\Script\final.txt" Global $line1 Global $line2 Global $line3 Global $y = _FileCountLines ( $file1 ) Global $x = 1 While $y > 0 FileOpen($file1, 0) $line1 = FileReadLine($file1, $x) FileOpen($file2, 0) $line2 = FileReadLine($file2, $x) FileOpen($file2, 0) $line3 = FileReadLine($file3, $x) Local $lineunite = $line1 & $line2 & $line3 FileWriteLine ( $filefinal, $lineunite ) $x = $x + 1 $y = $y - 1 Wend
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