Can somebody please tell me where Ive gone wrong with the script?
It writes the readline value multiple times, when it shoudl only write it once when the value is the same.

Also the line i'm reading is something like value=123
Is it possible to obtain just the 123, as readline takes the whole line?

Thanks

$file="c:\temp\last.cfg"
$search_for_line="lcfd_version"

IF Open(1, $file) = 0
$Version = ReadLine(1)
WHILE @ERROR = 0

IF (Instr($Version,$search_for_line) = 1)
If Open(5,"\\servername\share$\@wksta.csv",5)=0
$RC=WriteLine(5,"$version")
$RC=Close(5)

Endif
Endif

$Version = ReadLine(1)
LOOP
Close (3)
ELSE