command line - Launch 7zip and fetch the output from the console -


in lazarus (freepascal) project added tasyncprocess options: [pousepipes,postderrtooutput] catch output , show last line.

using readdata event, added code show last line if grab text:

procedure tform1.asyncprocess1readdata(sender: tobject); var   aoutput: tstringlist;   icpt: integer;   sline: string; begin   aoutput := tstringlist.create();   aoutput.loadfromstream(asyncprocess1.output);    if (aoutput.count > 0)   begin     setstatus(aoutput.strings[aoutput.count-1]);   end; end;   

then tryed last non-empty line:

procedure tform1.asyncprocess1readdata(sender: tobject); var   aoutput: tstringlist;   icpt: integer;   sline: string; begin   aoutput := tstringlist.create();   aoutput.loadfromstream(asyncprocess1.output);    if (aoutput.count > 0)   begin     // last non-empty line     icpt := (aoutput.count-1) 0     begin       sline := aoutput.strings[icpt];       if length(trim(sline)) > 0       begin         setstatus(sline);         break;       end;     end;   end; end;   

both shows nothing. i've used first code ffmpeg success. thanks!


Comments