Guest urifoox Posted October 1, 2004 Posted October 1, 2004 Hi All, New to AutoIt, quick question. I have a file with 5 lines, I want to read the file, and modify the fifth line? In Perl I would just pipe the file to an array, make a $counter, up the $counter until 5, then just append to the line. I'm assuming the process is similar in AutoIt, can anyone give me the code and walk me through it? Thanks.
this-is-me Posted October 1, 2004 Posted October 1, 2004 Try the helpfile. FileOpen comes to mind. Who else would I be?
Guest urifoox Posted October 1, 2004 Posted October 1, 2004 Try the helpfile. FileOpen comes to mind.<{POST_SNAPBACK}>Nevermind...I got it.;** Variables$count = 1Dim $aArray[6];** Create Array$file = FileOpen("c:\abc", 0)While $count <= 5 $chars = FileReadLine($file) If @error = -1 Then ExitLoop $aArray[$count] = $chars $count = $count + 1Wendfileclose("c:\abc");** Rewrite File$count2 = 1$file = FileOpen("c:\abc", 2)while $count2 < $count if $count2 = 5 then FileWriteline($file, $aArray[$count2] & " New Text") else FileWriteline($file, $aArray[$count2]) endif $count2 = $count2 + 1Wendfileclose("c:\abc")Might not be the prettiest, but it works.
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