Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

RUN action



Function

The action runs a specified external program.

Declaration


Blok kódu
languageesl
themeConfluence
RUN "program name" [HIDE]  SYNC/ASYNC [paramExpr_Str] [TIMEOUT timeOutExprStr_Int]


 

or

 


Blok kódu
languageesl
themeConfluence
intIdent_Int := RUN "program name" [HIDE] SYNC [paramExpr_Str] [TIMEOUT timeOutExpr_Int]


 
 
 


Blok kódu
languageesl
themeConfluence
RUNEX _toExec [HIDE] SYNC/ASYNC [paramExpr_Str] [TIMEOUT timeOutExprStr_Int]
 
or
 


Blok kódu
languageesl
themeConfluence
intIdent_Int := RUNEX  _toExec [HIDE] SYNC [paramExpr_Str] [TIMEOUT timeOutExpr_Int]

Parameters


"program name"inExecutable program name (optionally in quotation marks).
intIdent_IntoutIdentifier  - program return code.
HIDEinOptional parameter - hide the window of the program you want to run.
SYNCinSynchronous program run (waiting for termination).
ASYNCinAsynchronous program run.
paramExpr_StrinExpression of String type, the result value of which will create parameters of the running program.
TIMEOUT timeoutExpr_IntinExpression of the Int type -the maximum program running time [s].
_toExecinIdentifier of the text type.

Description

The RUN action will run the program determined by text string "program name". RUNEX action will run the program determined by value of identifier of text type _toExec.
In the first type of the declaration, it is able to specify whether the program will be run synchronously (SYNC), or asynchronously (ASYNC). The second type is always asynchronous. After the program termination, its return code is assigned to the identifier of the Int type.

If the maximal program running time is limited by the keyword TIMEOUT and the program is not to be terminated in this time limit, the program is to be terminated and the program and the return value (for the first type) gets the value _ERR_TIME_OUT.

In some cases, the parameter program name must be created on the basis of text operations. It is recommended to use RUNEX action to run program determined by value of text identifier _toExec.
The same result is reached by RUN action but the program name must be an empty text string and whole command is to be declared as parameter using the expression paramExpr_Str (see the example below).

If RUN action is used with the return code and starting the program failed, return code (intIdent_Int) will have an invalid value.

Note:
For OpenVMS only asynchronous - without parameters.

Example

The following example copies the file d:\d2000.v70\prefix\sqlback\syscfg.db into the directory c:\archive using standard facilities of the operating system (shell will run the command copy).

 


Blok kódu
languageesl
themeRDark
  ; Copying the file
 
 ; Source file
 TEXT _copySrc = "d:\d2000.v70\prefix\sqlback\syscfg.db"
 ; Target directory
 TEXT _copyDst = " c:\archive"
 ; Parameters for the command copy
 TEXT _switch = "/Y "
 ; Return code
 INT _ret
 
 _ret := RUN "cmd /C copy " SYNC _switch + _copySrc + _copyDst
  
 ; or whole command declared as expression

 ; _ret := RUN "" SYNC "cmd /C copy + _switch + _copySrc + _copyDst
 
 IF _ret # _ERR_NO_ERROR THEN
  ; error
 ENDIF
 END

Info
titleRelated pages:

Script actions