RUN

Purpose:

Runs an external program.

Syntax:

RUN("filename", wait, showmode, bgtime)

"filename"

-

A string, the filename of the program to run.

wait

-

Optional. A negative integer specifying the process wait mode:

-1:

runs the specified program without displaying it and waits until the program has terminated before returning. Useful for programs without a user interface.

-4:

runs the program using showmode if specified and waits until the program has terminated before returning.

If wait is not specified, DADiSP does not wait and continues to run concurrently with the executed program.

showmode

-

Optional. A positive integer specifying the display mode of the application to run.

0:

hidden

1:

normal (default)

2:

minimized

3:

maximized

If wait is 1, showmode has no effect.

bgtime

-

Optional. An integer specifying the background monitor time in milliseconds. If specified, the executing program is queried every bgtime milliseconds to determine if it is still running.  Ctrl-Break can be used to terminate monitoring of the task. Defaults to 0, no background task monitoring.

Example:

run("MYPROG")

 

runs the program "MYPROG" without waiting.

 

run("dir > tmpfile", -1);viewfile("tmpfile")

 

runs the dir system command without display and waits until the task has completed, then returns control to DADiSP. The result of the listing is displayed after the command has completed.

 

run("notepad", 3)

 

runs Notepad maximized and does not wait until Notepad is finished.

 

run("notepad", -4, 3)

 

runs Notepad maximized and waits for Notepad to finish before returning to DADiSP.

Remarks:

RUN can call executable programs written in any language. The only limitation is the amount of system memory available for the external program.

 

An error message is displayed if the program cannot be executed.

 

If bgtime is specified, the executing task is queried every bgtime milliseconds to determine the task state. In this case, task monitoring can be terminated by pressing Ctrl-Break.

 

See SHELLEXECUTE to process a file using a system defined application.

See Also:

dadisp.cnf (configuration file)

DOS, VMS or UNIX macro

SETCONF

SHELL

SHELLEXECUTE