amakrkr Posted November 16, 2009 Share Posted November 16, 2009 hello, i have the following tast to do. In my case i have two .txt files. Now i have to make an outomated script that will run non stop checking in Primal.txt for new lines and if it will find them they will be copied to the Copy.txt file. Here is my script so far....but it doesnt work for some odd reason, maybe someone of you could take a quick look at it? thx #include <File.au3> $file = FileOpen("C:\Users\agg\Desktop\ascii to ascii\Primal.txt", 1) $file_copy = FileOpen("C:\Users\agg\Desktop\ascii to ascii\Copy.txt", 1) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop FileWriteLine($file_copy, $line) Wend FileClose($file) FileClose($file_copy) Link to comment Share on other sites More sharing options...
jvanegmond Posted November 16, 2009 Share Posted November 16, 2009 (edited) --- Edited March 21, 2018 by jvanegmond github.com/jvanegmond Link to comment Share on other sites More sharing options...
amakrkr Posted November 16, 2009 Author Share Posted November 16, 2009 (edited) It's most likely the flags you are using for FileOpen. One should be opened in read mode, and one in write mode. my god so simple ^^ it works great now thx !! it sohuld be like this: #include <File.au3> $file = FileOpen("C:\Users\xxxxx\Desktop\ascii to ascii\Primal.txt", 0) $file_copy = FileOpen("C:\Users\xxxxx\Desktop\ascii to ascii\Copy.txt", 1) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop FileWriteLine($file_copy, $line) Wend FileClose($file) Edited November 16, 2009 by amakrkr Link to comment Share on other sites More sharing options...
jvanegmond Posted November 16, 2009 Share Posted November 16, 2009 No problem. Happy coding. github.com/jvanegmond Link to comment Share on other sites More sharing options...
amakrkr Posted November 16, 2009 Author Share Posted November 16, 2009 sorry to bother you again. I just found my next problem.... when i copy from Primal.txt to Copy.txt i dont want to duplicate the records. For example i would like my program to copy only those lines which are in Copy.txt. i hope you understand what i mean. So far i came up with this: but it doesnt work for some reason.... #include <File.au3> $file_check = FileOpen(@ScriptDir & "\Primal.txt", 0) $file = FileOpen(@ScriptDir & "\Primal.txt", 0) $file_copy = FileOpen(@ScriptDir & "\Copy.txt", 1) While 1 $line = FileReadLine($file_check) $line_c = FileReadLine($file_copy) if $line = $line_c Then ExitLoop EndIf If @error = -1 Then ExitLoop FileWriteLine($file_copy, $line) Wend FileClose($file) Link to comment Share on other sites More sharing options...
amakrkr Posted November 16, 2009 Author Share Posted November 16, 2009 any suggestions guys? Link to comment Share on other sites More sharing options...
jvanegmond Posted November 16, 2009 Share Posted November 16, 2009 (edited) Please wait 24 hours before bumping your own topic. Personally, I have no clue what you're trying to do. Not even remotely, so I was hoping maybe someone else would be able to decipher what you were asking. Edited November 16, 2009 by Manadar github.com/jvanegmond 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