Board index » delphi » executing external programs

executing external programs

Would someone be so kind as to post an example of a procedure that
executes an external program.

I currently have code that stores random numbers in a bat file that is
later executed.  Each of the numbers drawn correspond to a specific
graphic file that is to be displayed.  Instead of relying upon a bat
file, I want to be able to randomly draw numbers, shell to dos, execute
the imager for the number of the file drawn.

TIA

CabaL (Hey Man Nice Shot)

 

Re:executing external programs


In <48b1q6$...@news2.ios.com> ca...@chelsea.ios.com (User) writes:

Quote
>Would someone be so kind as to post an example of a procedure that
>executes an external program.
>I currently have code that stores random numbers in a bat file that is
>later executed.  Each of the numbers drawn correspond to a specific
>graphic file that is to be displayed.  Instead of relying upon a bat
>file, I want to be able to randomly draw numbers, shell to dos, execute
>the imager for the number of the file drawn.
>TIA
>CabaL (Hey Man Nice Shot)

Executing an external file can be done by using the Exec procedure.
Your code should be something like this:

   SwapVectors;
   Exec(filename: string; commandline: string);
        SwapVectors;

Note that filename must contain the complete path of the file to be
executed.  Let's say you want to run WordPerfect and WP.EXE is located
in the directory C:\WP51.  You do not want to use any command line
options.  The Exec command would be: Exec('C:\WP51\WP.EXE', '');

Alexander.
--
+--------------------------------+
| Alexander op de Weegh          |
| E-mail: e9...@mimas.hts.hsa.nl |
+--------------------------------+

Other Threads