Free Pascal Program Tutorial 28 – Running External Programs – IE Batch MS Paint Calculator – Lazarus

7
130

http://www.schoolfreeware.com

To execute an external program from within the pascal code is a simple process. TProccess will do it quickly. TProcess requires Process added to the uses area.

This Is The Setup:

uses Process;

var
  RunProgram: TProcess;

begin
  RunProgram := TProcess.Create(nil);
  RunProgram.CommandLine := ‘Path and Name of Program’;
  RunProgram.Execute;
  RunProgram.Free;
end;

Links of Interest:

Lazarus (Free Pascal) Wiki article on executing external programs.
http://wiki.lazarus.freepascal.org/Executing_External_Programs

TProcess Code:
http://lazarus-ccr.sourceforge.net/docs/fcl/process/tprocess.html

TProcess Help For Mac:
http://www.mail-archive.com/[email protected]/msg01971.html

TProcess Help For Linux:
http://www.mail-archive.com/[email protected]/msg20819.html

source