var   LogFile :TFileStream;
      s : string;
      Log :integer;

      FName :string;

      List :TStringList;
begin

    FName := getapplocaldatafolder+'script_debug1.log';

    (*
    if fileexists(FName) then Log := FileOpen(FName,fmOpenWrite)
    else Log := FileOpen(fName,fmC
    reate);
    try
      FileSeek(Log,0,soFromEnd);
      FileWrite(Log,'Start Test'+#13+#10);
      FileWrite(Log,'End Test'+#13+#10);
    finally
      FileClose(Log);
    end;*)


    (*


    LogFile := TFileStream.Create(getapplocaldatafolder+'script_debug.log',  fmCreate + fmOpenWrite);
    try
      LogFile.Seek(0,soFromEnd);

      S := 'Text';

      LogFile.Write(s,length(S));
      LogFile.Write(' End Test '+#13+#10,12);
    finally
      LogFile.free
    end;
    *)

    List := TstringList.create;
    if fileexists(FName) then List.loadFromFile(FName);
    List.add('Begin');
    List.add('end');
    List.savetofile(FName);
    list.free;

end.
