TProcess a executable line by line lazarus / 32-Linux ---------------------------------------------------------------------- pascalbythree · 2021-10-09 19:27 Anybody got example code to TProcess a executable and then copy eatch apeard line in a string, line by line?, Greetz Wouter ---------------------------------------------------------------------- MarkMLl · 2021-10-09 19:34 Is this intended as a continuation of your https://forum.lazarus.freep ascal.org/index.php/topic,56655.msg421124.html#msg421124 ? This isn't IRC, and I'd suggest that once you've started a thread it is appropriate to wait for responses (and to answer people who ask for clarification). MarkMLl ---------------------------------------------------------------------- Edson · 2021-10-09 21:28 You can use: https://github.com/t-edson/UnTerminal Then capture the output line by line using: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   proc := TConsoleProc.Create(nil);  proc.OnLineCompleted:=@procOnLineCompleted;  proc.Open('cmd /c dir','');  ... procedure TForm1.procOnLineCompleted(const lin: string);begin  Memo.Lines.Add(lin);end; ---------------------------------------------------------------------- pascalbythree · 2021-10-10 15:37 This is 100% procent where i am looking for, UnTerminal-1.0 except its seems to be only to work in lazarus GUI Do you know  a software package similar for the RaspBian LITE version? Because it only has to be to work in the console, without GUI. ---------------------------------------------------------------------- Edson · 2021-10-10 16:17 Quote from: pascalbythree on October 10, 2021, 05:37:53 pmexcept its seems to be only to work in lazarus GUI Do you know  a software package similar for the RaspBian LITE version? Because it only has to be to work in the console, without GUI. Check the Example3 project in the Github. It's a console application. If you don't want to include the LCL dependency, remove the references to TPanel or TTimer in the library. In this case you can use the functions: RunInLoop() to control a process. ---------------------------------------------------------------------- pascalbythree · 2021-10-10 19:00 Only seems to work while xwindows is running. Are you sure it is possible if booted to the command line? ---------------------------------------------------------------------- Edson · 2021-10-10 21:28 I've tested in Linux and Windows. In command line only in Windows. I don't know what process are you trying to control. ---------------------------------------------------------------------- pascalbythree · 2021-10-11 11:50 Just trying to start Avrdude on a Raspberry lite then line by line in my fpc console application So if i may repeat a little, not possible without a linux GUI ? Thanks. ---------------------------------------------------------------------- MarkMLl · 2021-10-11 12:14 Quote from: pascalbythree on October 11, 2021, 01:50:53 pmJust trying to start Avrdude on a Raspberry lite then line by line in my fpc console application See the thread you started before. I asked you a couple of specific questions, and you didn't bother to answer. MarkMLl ---------------------------------------------------------------------- prof7bit · 2021-10-11 13:55 answered with a code snippet in your other thread ---------------------------------------------------------------------- bills · 2022-09-18 07:24 Quote from: Edson on October 10, 2021, 11:28:25 pmI've tested in Linux and Windows. In command line only in Windows. I don't know what process are you trying to control. Thank you Edson. I download the UnTerminal-1.0. When I compile and run the example, first click the start button(the command text is: CMD), sencond click the Send button(the command text is dir), then the application give the message: Error setting stream size. My os is windows10. ---------------------------------------------------------------------- Edson · 2022-09-18 17:36 Quote from: bills on September 18, 2022, 09:24:37 amThank you Edson. I download the UnTerminal-1.0. When I compile and run the example, first click the start button(the command text is: CMD), sencond click the Send button(the command text is dir), then the application give the message: Error setting stream size. My os is windows10. Hi. It seems something has changed in Lazarus LCL recently. Now I cannot set: TProcess.Input.Size. I had to comment that part in the library. Now is working. Repository in Github has been updated. ---------------------------------------------------------------------- bills · 2022-09-20 14:23 Thanks Edson. Now the program is run ok. ---------------------------------------------------------------------- rvk · 2022-09-20 14:32 Quote from: pascalbythree on October 09, 2021, 09:27:56 pmAnybody got example code to TProcess a executable and then copy eatch apeard line in a string, line by line?, Greetz Wouter You already got this code from the other topic: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if RightStr(Line, Length(LineEnding)) = LineEnding then begin;  Line := Trim(Line);  Print(Line); // ----> This is a completed string  Line := '';end;Line 3 (and after line 5) has a completed string in Line variable each time (so 'line by line'). So what more (or else) do you want?