Calling Non-QA Build Programs

You can call any executable program, or other command known to the operating system. For example, to run a DP4 report on the current database you could enter this command:
repprint -db %DB -prog myrep

Commands

Enter a command as you would at the operating system command line, except that if a command requires a % enter %%. A single % introduces one of the special command tails. When running the command the current path will be searched as determined by the operating environment. On Windows CE, there is no path or current directory and commands without a directory specification will be searched for in the directory where DP4 is loaded from.

Command Tails

You can specify any command tails (program arguments) exactly as you would at a command prompt. The total length of the command line is limited to 128 characters.

%1 to %9

Where command tails are to be entered by the user at run time, specify each command tail using %1, %2, up to %9.

You will need to set up each of the command tails as fields on the main map of your procedure. Number the fields for each of the command tails, 1 9. This allows the command tails to be entered when the program is called. The evalues entered by the user will be substituted as appropriate.

Rather than relying on this facility you may prefer to allow the user to enter comamnd tails in earlier procedures and then use the %field_name% facility described below. This would be useful if the value is selected using a multiple choice map or some other menu.

%BATCH

DP4 first tries to execute the command as a normal command. If the program cannot be executed, DP4 will ask the operating system shell to run the command. As the name suggests this is typically used to launch batch files or shell scripts. However, it can be used to launch any type of command launchable from the shell, such as internal commands.

%CLOSEDB

Close the current database before executing the command. The database will be reopened on return. This is useful if you want to run a DP4 program that requires exclusive access to the database, or any program that accesses the database directly such as a backup utility.

%DB

Current database. This would normally be used with the DP4 command tail −DB. Thus, −DB %DB.

%DOCUMENT

This command tail is only used in Windows. It informs DP4 that the program should be run using the ShellExecute() command. The command line should consist of a single "document" name, at the operating system will open it using the users preferred program and default "open" command for opening that type of document. The "document" can be almost anything in fact. For example you could use the command mailto:%name% %document to open the users preferred mail composer to send an e-mail to the address given in the name variable.

%<field_name>%

This command tail is used to substitute the contents of the named character field. This allows you to pass the contents of a field as a parameter to a program. For example, if you define a local field dir, which contains the text "b:", you could call a program as follows:

dbrestor %closedb -db %db -disk %dir%

The contents of the field dir is substituted at run time.

The substituted value cannot itself include any other %options.

%NOLOG

Suppress a line being written to the system log.

When a program is called an entry is made in the system log, SYSLOG.PRN, unless this options is speicified.

%NOWAIT

(Currently Windows only). Normally when a program is run DP4 will wait for the called program o take and then restore focus to the calling program. If you want to run a program completely asynchronously then specify the %NOWAIT option. For this option to work well you may well also require the program to be executed to run minimised. For DP4 progrmams see information for detach=1 in the Guide to DP4 configuration.

%PAUSE

Pause after the program has executed. This prompts the user to press any key to continue. This option is useless on Windows like operating systems (unless you use the console version of the DP4 terminal manager), but may be useful elsewhere to allow the output of the executed program to remain visible.

%SERVER

This argument is only relevant when the DP4 Terminal Server is used. It forces the program to be run with its user interface on the server. Normally when a DP4 program is run through the DP4 Terminal Server the program will run on an application server with its user interface on the same work station as the calling program. This might be useful for "remote administration" type functions such as scheduling a backup.

%TERMINAL

This argument is only relevant when the DP4 Terminal Server is used. It forces the program to be run on the workstation. Normally when a DP4 program is run through the DP4 Terminal Server the program will run on an application server with its user interface on the same work station as the calling program. This might be useful for running programs that are installed locally (usually non DP4 programs).

%WAIT

(Currently Windows only). Normally when a program is run DP4 will wait for the called program o take and then restore focus to the calling program, but not for it to necessarily terminate. If you want to run another program completely synchronously then specify the %WAIT option.

This option will not work for running 16 bit programs from 32 bit programs on a Windows NT family operating system.