Re: importing variables from external file: additional information

Posted by Stefan Loeners on January 17, 2010

In Reply to Re: importing variables from external file posted by Felice P16730 on January 16, 2010

Dear Felice,

First of all, thanks for responding.

I figured that my request needed some additional explanation.

My Delphi app is a file conversion system, to convert PDFs, Word docs, graphics files, etc.. It uses external executables, and launches those via Winexec with command line parameters.
The reason why I am using an ini file is because I want my application to be flexible. When I add more executables to my system, I want to limit the programming to a minimum. Indeed, part of the code is in the ini file.

I will take IRFANVIEW as an example to illustrate how my application works.

For example, the following command line string converts a .DWG file to .JPG
\tools\irfanview\i_view32.exe SourceDir\*.dwg /advancedbatch /convert=TargetDir\*.DWG

SourceDir (location of the DWG files to be converted to JPG) and TargetDir (location of the files that have been converted to JPG) are variables in my Delphi application.
SourceDir and TargetDir are not fixed. The user has to select them both from a directory dialog box within my Delphi application.

To illustrate this differently, here is the sequence of events
1. The user selects the DWG to JPG type of conversion from a listbox and selects source and target directory in the Delphi app and clicks OK
2. The Delphi app reads the following command line from the INI file: \tools\irfanview\i_view32.exe SourceDir\*.dwg /advancedbatch /convert=TargetDir\*.DWG
3. The Delphi app fills in the SourceDir and TargetDir variables with the values selected by the user
4. The delphi app launches winexec with the parameters

It is part 3 that is the difficult bit. Simply reading the command line string
\tools\irfanview\i_view32.exe SourceDir\*.dwg /advancedbatch /convert=TargetDir\*.DWG
into a string variable does not work.

Any suggestions?

Thank you very much.
Stefan Loeners

Related articles


Follow Ups