Hi All,
 I am having real problems getting my app to run using TProcess. I have a 
procedure that encapsulates process like below

procedure TMainForm.ExecNewProcessNoDir(app,cmd: string; Wait: Boolean);
var
   AProcess: TProcess;
begin
   AProcess := TProcess.Create(nil);
 try
   Aprocess.ShowWindow := swoShowNormal;
    if cmd <> '' then
    AProcess.CommandLine := app+' '+cmd
     else AProcess.CommandLine := app;
   if wait = True then
       AProcess.Options := AProcess.Options + [poWaitOnExit];
   AProcess.Execute;
 finally
   AProcess.Free;
 end;
end;       

Now I call the procedure as follows using the following arguments
 app:='/cadtools/linux/ecsConverter/source/converter.pl';
cmd:= Dir1+' -pdk '+Dir2+' -def> Conv.log';
  MainForm.ExecNewProcessNoDir(app,cmd,true);

Where Dir1 and Dir2 are directories. If I explicitly write the paths for Dir1 
and Dir2 so I pass
cmd:='/home/lefti/test/rev -pdk /etc/test/rev -defMulti> ecsConverter.log'
this works ok. I recall one user said that cmd does not understand + and all 
that. The question is how do I pass variables since I cannot hard wire
cmd.
All the help is much appreciated. Thanks

Lefti


    



----------------------------------------
> Date: Fri, 14 Dec 2007 10:37:18 +0000
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: Re: [lazarus] TProcess question
> 
> On 14/12/2007, el stamatakos  wrote:
>>
>> Hi,
>>  I would like to run a perl script that accepts some arguments and also 
>> outputs info to a log file. I would like to be able to do something like
>>
>> cmd = "cd " + DestinationDirPath +  " ; setenv PATH $PATH{:$LOC} ; 
>> ${LOC}/prog.pl " + DirFiles + " -dk " +  TemplateDirPath + "  -defMulti> 
>> prog.log"
>>
>> How would I do something like this in Lazarus using the TProcess or any 
>> other funtion or method to launch the perl script with the proper inputs.
>>
> 
> this might help: http://wiki.freepascal.org/Executing_External_Programs
> 
>> Thanks
>>
>> Best,
>>
>> Lefti
>>
> 
> henry
> 
> _________________________________________________________________
>      To unsubscribe: mail [EMAIL PROTECTED] with
>                 "unsubscribe" as the Subject
>    archives at http://www.lazarus.freepascal.org/mailarchives

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to