Recent

Author Topic: TProcessUTF8 not running certain commands  (Read 2277 times)

carlangas

  • Jr. Member
  • **
  • Posts: 59
TProcessUTF8 not running certain commands
« on: October 14, 2017, 08:29:21 pm »
I am trying to run commands through TProcessUTF8. I want to convert between different formats using various tools, including postscript. To manipulate images, I use imagemagick's convert.

I need to quote with double inverted commas to allow correct translation of file names (I am using Linux).

If I use

Code: Pascal  [Select][+][-]
  1.     Command.CommandLine:='convert  "/tmp/01 01.png" "/tmp/out/test 01.ps"';
  2.     Command.Execute;  

Everything is fine. Unfortunately, the resulting output file tends to be huge, so I try to make it smaller:

Code: Pascal  [Select][+][-]
  1.     Command.CommandLine:='convert  "/tmp/01 01.png" -compress jpeg eps3:"/tmp/out/test 01.ps"';
  2.     Command.Execute;  

But, once I add some parameters, it seems to do nothing.

How should I send the command to make it work properly?

Thanks

Fungus

  • Sr. Member
  • ****
  • Posts: 354
Re: TProcessUTF8 not running certain commands
« Reply #1 on: October 14, 2017, 08:45:18 pm »
You have double space in your command. You should set TProcessUTF8.Executable to the binary you want to invoke and then use TProcessUTF8.Parameters to specify parameters:

Code: Pascal  [Select][+][-]
  1. Command.Executable:= 'convert';
  2. Command.Parameters.Clear;
  3. Command.Parameters.Add('/tmp/01 01.png');
  4. Command.Parameters.Add('-compress');
  5. Command.Parameters.Add('jpeg');
  6. Command.Parameters.Add('eps3:/tmp/out/test 01.ps');
« Last Edit: October 14, 2017, 08:46:56 pm by Fungus »

carlangas

  • Jr. Member
  • **
  • Posts: 59
Re: TProcessUTF8 not running certain commands
« Reply #2 on: October 14, 2017, 10:36:35 pm »
Thanks. It works perfectly after that. I don't know what I did wrong when I tried to use parameters before, but now it is right.

 

TinyPortal © 2005-2018