Recent

Author Topic: Please help me run command Say with TProcess  (Read 316 times)

laguna

  • Sr. Member
  • ****
  • Posts: 287
Please help me run command Say with TProcess
« on: May 31, 2020, 10:44:38 am »
Hi, this script not run, without parameter only "Hello" is ok,
but with parameter, one row or two row add two Approcess.Parameter.add not run,
not generate output.
   
   AProcess := TProcess.Create(nil);
   AProcess.Executable := 'say';
   AProcess.Parameters.Add( '-o /Users/Vincenzo/Desktop/zhi.aiff "hello"');
   AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
   AProcess.Execute;

Thenks
Vincenzo

PascalDragon

  • Hero Member
  • *****
  • Posts: 1698
  • Compiler Developer
Re: Please help me run command Say with TProcess
« Reply #1 on: May 31, 2020, 10:49:29 am »
If you want the output on the current console you must not include poUsePipes, cause then you must handle the AProcess.Output stream yourself.
Also you need to add all parameters separately:

Code: Pascal  [Select][+][-]
  1. AProcess := TProcess.Create(nil);
  2. try
  3.   AProcess.Executable := 'say';
  4.   AProcess.Parameters.Add( '-o');
  5.   AProcess.Parameters.Add( '/Users/Vincenzo/Desktop/zhi.aiff');
  6.   AProcess.Parameters.Add( 'hello');
  7.   AProcess.Options := AProcess.Options + [poWaitOnExit];
  8.   AProcess.Execute;
  9. finally
  10.   AProcess.Free;
  11. end;

laguna

  • Sr. Member
  • ****
  • Posts: 287
Re: Please help me run command Say with TProcess
« Reply #2 on: May 31, 2020, 11:10:56 am »

Is run.

Thanks.

laguna

  • Sr. Member
  • ****
  • Posts: 287
Re: Please help me run command Say with TProcess
« Reply #3 on: May 31, 2020, 11:29:03 am »
Hi, exist mode to open windows terminal e run this command in
say "hello, this is the computer talking" --interactive

Thanks


Leledumbo

  • Hero Member
  • *****
  • Posts: 8222
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Please help me run command Say with TProcess
« Reply #4 on: May 31, 2020, 07:21:04 pm »
Hi, exist mode to open windows terminal e run this command in
say "hello, this is the computer talking" --interactive

Thanks
Now for that you have to do the other way around. Use poUsePipes and handle both AProcess.Output (read it don't let the buffer full) and AProcess.Input (write your interactive input here, don't forget to end with newline as most interactive programs expect that).

 

TinyPortal © 2005-2018