Jens...
I tried the InsertLine() function and it didnt work properly. I ran this...
Code:
$null = insertline('file.txt',17,'alternate shell:s:d\integra\destiny\filename.exe -d "First One Database"',1)
$null = insertline('file.txt',18,'shell working directory:s:d\integra\destiny',1)
Function insertline($a, $b, optional $c, optional $d)
Dim $e,$f,$h,$x,$y
If $b<0 Exit -3 EndIf
If $c="" $d=1 EndIf
$f="%temp%\~kixil00.tmp" ; temporary file to use
Del $f
If $d<>1 $d=0 EndIf
$e=FreeFileHandle
$insertline=-2
If $e=0 Exit -2 EndIf
$insertline=Open($e,$a)
If $insertline<>0 Exit @Error EndIf
$h=FreeFileHandle
If $h=0
$insertline=-2
$x=Close($e)
Exit -2
EndIf
$insertline=Open($h,$f,5)
If $insertline<>0
$x=Close($e)
Exit @Error
EndIf
If $b<>0
For $x=0 To $b-1
$y=ReadLine($e)
If @Error<>0
$x=Close($e)
$x=Close($h)
Del $f
$insertline=-3
Exit -3
Else
$insertline=WriteLine($h,$y+@Crlf)
EndIf
Next
EndIf
$insertline=WriteLine($h,$c)
$y=ReadLine($e)
If @Error<>0
$x=Close($e)
$x=Close($h)
Del $f
$insertline=-3
Exit -3
EndIf
If $d=0
$x=WriteLine($h,$y+@Crlf)
EndIf
$y=ReadLine($e)
While @Error=0
$insertline=Writeline($h,$y+@Crlf)
$y=ReadLine($e)
Loop
$x=Close($e)
$x=Close($h)
Copy $f $a
Del $f
$insertline=0
Exit 0
EndFunction
And got this in the text file...