11.2.8 Exec method (call an executable file)
- Purpose
-
Calls an executable file (EXE file, BAT file, COM file, SPT file, CMD file, or linked file) according to specified parameters. You can specify whether to wait for the called application to complete.
- Syntax
Object.Exec(FileName, Flag, Parameter)
- Arguments
-
- Object
-
Specify the object representing the reference to the SPTO control.
- FileName
-
Specify the executable file to be called as a string value.
You can specify any of the following types of files:
-
Executable file (.EXE)
-
MS-DOS batch file (.BAT)
-
MS-DOS executable file (.COM)
-
JP1/Script script file (.SPT)
-
command script (.CMD)
-
Linked file
-
- Flag
-
Specify a Boolean value indicating whether to wait for the executable file specified in FileName to complete execution. Specify True to wait for completion; otherwise, specify False.
- Parameter
-
Specify the necessary parameters for executing the file specified in FileName. Write each parameter as a string value, using a space to separate each parameter.
The following strings have a special meaning when specified as a parameter:
Parameter
Meaning
/SPT:HIDE
Hides the application window.
/SPT:MIN
Minimizes the application window to an icon.
/SPT:MAX
Maximizes the application window.
The parameters are passed as command line parameters to the executable file. The strings /SPT:HIDE, /SPT:MIN, and /SPT:MAX are not passed as command line parameters.
- Description
-
The Exec method executes a specified executable file.
If you specify True in Flag, execution control waits for the called application to complete. If you specify False, control moves to the next processing without waiting for the application to complete.
The method returns True if the application completes normally, or False in all other cases.
If you specify True in Flag and the execution result is True, the executable file's exit code is stored as a long integer in the EXECRTN property. Nothing is stored in this property if you specify False in Flag or if False is returned as the method's execution result.
If you specify False in Flag, the executable file ID is stored as a string value in the EXECID property.
- JP1/Script version
-
Supported from JP1/Script 05-00.