Recent

Author Topic: Process and Terminal  (Read 1221 times)

amedeo

  • New Member
  • *
  • Posts: 39
Process and Terminal
« on: April 18, 2022, 09:10:14 am »
Hallo, I want to read a CDROM and I use icedax or cdd2wav command.
if into terminal I write the command line it go right but I want to execute command and not to see terminal
please somebody can tell me why the execution of this code show me terminal but not the string Add-ed?
where I forgot in code?
Code: Pascal  [Select][+][-]
  1. Code: Pascal  [Select]
  2.       AProcess:= TProcess.Create(nil);
  3.       AProcess.Executable:='gnome-terminal';
  4.       AProcess.Parameters.Clear;
  5.       AProcess.Parameters.Add('icedax -J -q -v titles -D '+LblEdtCDRomSel.Text) ;
  6.     //  AProcess.Options := AProcess.Options + [poWaitOnExit];
  7.       AProcess.Execute;
  8.       AProcess.Free;
  9.      

Thanks

PascalDragon

  • Hero Member
  • *****
  • Posts: 6230
  • Compiler Developer
Re: Process and Terminal
« Reply #1 on: April 18, 2022, 12:44:16 pm »
You need to use icedax as the application and add the parameters separately:

Code: Pascal  [Select][+][-]
  1. AProcess.Executable:='icedax';
  2. AProcess.Parameters.Add('-J');
  3. AProcess.Parameters.Add('-q');
  4. AProcess.Parameters.Add('-v');
  5. AProcess.Parameters.Add('titles');
  6. AProcess.Parameters.Add('-D');
  7. AProcess.Parameters.Add(lblEdtCDRomSel.Text);

amedeo

  • New Member
  • *
  • Posts: 39
Re: Process and Terminal
« Reply #2 on: April 18, 2022, 05:35:42 pm »
 %) icedax is not a executable file in /bin

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12563
  • FPC developer.
Re: Process and Terminal
« Reply #3 on: April 18, 2022, 05:42:42 pm »
Does


gnome-terminal "icedax -J -q -v titles -D blablabla"

(with blabla for  LblEdtCDRomSel.Text)  work if you enter it on the commandline ?

Because that is what your code does. It gives the whole icedax line as one single parameter. If you want to do it separate, you need to do it like Pascaldragon does with multiple adds

amedeo

  • New Member
  • *
  • Posts: 39
Re: Process and Terminal
« Reply #4 on: April 19, 2022, 12:18:50 pm »
Thank for your attention but the string:

'gnome-terminal "icedax -J -q -v titles -D blablabla" '

in Executable return me error: 'not found'

If I use in Executable: 'gnome-terminal'  (not 'gnome-terminal ')
and in the terminal window the command  'icedax ....' it works good
 %)  >:D

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12563
  • FPC developer.
Re: Process and Terminal
« Reply #5 on: April 19, 2022, 01:10:05 pm »
Thank for your attention but the string:

'gnome-terminal "icedax -J -q -v titles -D blablabla" '

in Executable return me error: 'not found'

Then first fix that, and find one single commandline to open a terminal and run icedax before trying to put it in code.

One could also argue that you don't really need a terminal, and searching the binary before passing it to tprocess might be an option.

amedeo

  • New Member
  • *
  • Posts: 39
Re: Process and Terminal
« Reply #6 on: April 19, 2022, 01:45:45 pm »
really I do not need terminal but I used it to run icedax.
How can I do it without terminal? I do not know how.
Can you please give me some idea  :)

 

TinyPortal © 2005-2018