Executing external programs

EasyMorph can run external applications and Windows shell commands either once or multiple times in a loop. Most frequently this is used for file manipulations (copying, renaming, unzipping, etc.) or integration with 3rd party applications.

Running external program

The "Run program" action starts the specified external application with command-line arguments (if required), and waits until it finishes.

The command line arguments for the application can be specified either as a constant line of text, or using an expression. In the latter case, the expression can use project parameters (but not field names).

Hint: Wrap file names in double quotes in command line expressions as they may contain spaces.

Executing a Windows shell command

If application is not specified (the application path is empty) then "Run program" executes the command line as a Windows shell command. The example below shows uses the "Run program" action for copying a file (show as an example, actual file copying can be done using the "File command" action described in the previous chapter).

Advanced topics

Iterating an external program or Windows shell command

Similarly to iterating EasyMorph projects, external applications can be iterated as well with the help of the "Iterate program" action. This action is similar to the "Iterate" action, but instead of running another EasyMorph module (or project) it runs a specified external application once for each row of a dataset. The command line in this case is specified using an expression. Therefore it can be calculated for each line of the dataset using fields, functions and parameters.

If the external application is not defined, the action executes the command line as a Windows shell command. It can be used, for instance, for mass copying/deleting/moving files without reusable projects.

Hint: To see what a calculated command line would look like you can pre-calculate command lines as a new column before iterating.

Capturing output

The "Run program" action allows capturing terminal screen output of an application or a Windows shell command. To capture output tick the "Capture output" checkbox in the action properties. Both STDOUT and STDERR are captured. Typical use cases for capturing output include error handling and obtaining calculation results from external applications without creating a file.


Read next: Web requests