bf2forlife Posted June 28, 2008 Posted June 28, 2008 So how to type "asd" in start of every line in .txt file?
Developers Jos Posted June 28, 2008 Developers Posted June 28, 2008 So how to type "asd" in start of every line in .txt file?What have you tried ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
bf2forlife Posted June 28, 2008 Author Posted June 28, 2008 I dont know where to start, only thing that pops on my mind that u could click in start of each line, but that would be slow and hard
NELyon Posted June 28, 2008 Posted June 28, 2008 I'm feeling generous today... #Include <File.au3> #include <Array.au3> Global $aLines, $sNewLines, $sPath = "./Test.txt" If Not FileExists($sPath) Then FileWrite($sPath, "line1" & @CRLF & "Line2" & @CRLF & "line3") _FileReadToArray($sPath, $aLines) For $i = 1 to $aLines[0] $sNewLines &= "asd" & $aLines[$i] & @CRLF Next FileDelete($sPath) Sleep(200) FileWrite($sPath, $sNewLines)
Moderators SmOke_N Posted June 28, 2008 Moderators Posted June 28, 2008 (edited) I'm feeling generous today... #Include <File.au3> #include <Array.au3> Global $aLines, $sNewLines, $sPath = "./Test.txt" If Not FileExists($sPath) Then FileWrite($sPath, "line1" & @CRLF & "Line2" & @CRLF & "line3") _FileReadToArray($sPath, $aLines) For $i = 1 to $aLines[0] $sNewLines &= "asd" & $aLines[$i] & @CRLF Next FileDelete($sPath) Sleep(200) FileWrite($sPath, $sNewLines)oÝ÷ Ûú®¢×ßÙeër¢ìاÚ.±ä^LiÉëOjëh×6$s_string = "I am a line of text in a text file" & @CRLF & _ "I am another line of text in a text file" & @CRLF & _ "I am the last line of text in a text file" $s_string = "asd" & $s_string $s_new_string = StringRegExpReplace($s_string, "\n", "\1asd") ConsoleWrite($s_new_string & @CRLF) Edited June 28, 2008 by SmOke_N damn code tags Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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