Break on
$file = "D:\m.txt"
$fileold = "D:\m.old"
$filenew = "D:\m.new"
$filecontents = ReadFile($file)
For Each $line in $filecontents
If Trim($line) <> ""
If InStr($line, "Status:")
$line = Split($line, " ")
$status = $line[UBound($line)]
EndIf
EndIf
Next
$rc = Open(1, $filenew, 5)
For Each $line in $filecontents
If Trim($line) <> ""
If InStr($line, "Place:")
? $line
$line = Split($line, "XXXX")
$line = Join($line, $status)
$rc = WriteLine(1, $line + @CRLF)
Else
$rc = WriteLine(1, $line + @CRLF)
EndIf
EndIf
Next
$rc = Close(1)
Move $file $fileold
Move $filenew $file
;Function ReadFile()
;
;Author Radimus
;
;Contributors Lonky... This is basically his code that I trimmed down to its
; simplest function
;
;Action Reads a file into an array
;
;Syntax $array=ReadFile($file)
;
;Version 1.0.1
;
;Date 10/21/2003
;
;Date Revised 10-22-2003 - dimmed vars
;
;Parameters file
; source filename
;
;Remarks Pair this with WriteFile() to read and write an entire file easily
;
;Returns @error if failed
;
;Dependencies None
;
;KiXtart Ver 4.02
;
;Example(s) $array=ReadFile('c:\file.txt')
Function ReadFile($file)
Dim $lf, $f, $_, $t
$lf = Chr(10)
$f = FreeFileHandle
$_ = Open($f, $file)
If @error Exit @error EndIf
Do $t = $t + $lf + ReadLine($f) Until @error
$_ = Close($f)
$ReadFile = Split(SubStr($t, 2), $lf)
EndFunction