Nachiket Posted November 19, 2007 Share Posted November 19, 2007 Say, I have a file named sample.txt with the following contents : - This is my first program Hello Hi I have written the following lines of code to open the file using autoit $d = "D:\" $f = "sample.txt" run( "cmd /c " & """" & $d & $f & """", "", @SW_HIDE ) WinClose("sample.txt - Notepad") Send("!n") Now I want to replace line2 in the sample.txt with some other content say "Bye" How can I do it ? Link to comment Share on other sites More sharing options...
zfisherdrums Posted November 19, 2007 Share Posted November 19, 2007 (edited) Hello Nachiket, Try this: #include <File.au3> $textFile = "sample.txt" _FileWriteToLine( $textFile, 3, "Bye", True ) Zach... Edited November 19, 2007 by zfisherdrums Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Link to comment Share on other sites More sharing options...
Nachiket Posted November 19, 2007 Author Share Posted November 19, 2007 Hello Nachiket, Try this: #include <File.au3> $textFile = "sample.txt" _FileWriteToLine( $textFile, 3, "Bye", True ) Zach... Thanks fisher , its working 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