Some code here - the others parts of the code is ok :
Code:
;*******************************
;** AmigaOS/MUITextEdit.mcc **
;** Suppression des codes ESC **
;*******************************
EnableExplicit
Global file.s, plaintext.s, line.s, i, n, c
If NumberOfCLIArgs() = 0
file = FileRequester(0)
Else
file = ProgramParameter() ; GetCLIArg()
EndIf
If file = ""
PrintN("Argument missing")
End
EndIf
If ReadFile(0, file)
While Eof() = 0
plaintext = ""
line = ReadString()
n = Len(line)
i = 1
While i <= n
c = Asc(Mid(line, i, 1))
If c = 27
i + 1
While i <= n
c = Asc(Mid(line, i, 1))
Select c
Case 'b', 'i', 'n', 'u':
i + 1
Break
Case 'p':
While i <= n
c = Asc(Mid(line, i, 1))
i + 1
If c = ']'
Break
EndIf
Wend
Break
EndSelect
Wend
Else
plaintext + Chr(c)
i + 1
EndIf
Wend
PrintN(plaintext)
Wend
CloseFile(0)
Else
PrintN("Can't open file")
EndIf