7.8. ExecuteSystemCommand

execute_system_command ‐ An action for executing an external command

7.8.1. Attributes

NameTypeDefaults
valueSTRINGNone (required)
stdinSTRINGEmpty string
stdoutSTRINGEmpty string

7.8.2. Description

This action is used to execute an external command. The string value of the value attribute defines the command that will be executed. If the string contains parenthesized expressions, they are dynamically evaluated as numerical expressions and their values replace the expressions in the string.

The string value of the stdin attribute refers to the scalar that will serve as standard input to the command.

The string value of the stdout attribute refers to the scalar that will serve as standard output to the command.

7.8.3. Expected children

None.

7.8.4. Expected target

None.

7.8.5. Example

The two execute_system_command examples below define two actions that executes two Perl scripts testIn.pl and testOut.pl. The value of the stdin and stdout attributes refer to local scalars that will serve respectively as input and output to the corresponding Perl scripts:

<scalar id="stdIn" value="Hello World" type="string"/>
<scalar id="stdOut" value="Foo bar" type="string"/>
<script id="keystroke_script">
  <command>
     <trigger type="keystroke" value="z"/>
     <action>
       <write_console value="keystroke_z: cats stdIn value to testIn.pl"/>
     </action>
     <action>
       <execute_system_command value="perl testIn.pl" stdin="stdIn"/>
     </action>
  </command>
  <command>
     <trigger type="keystroke" value="Z"/>
     <action>
       <write_console value="keystroke_Z: cats ouput of testOut.pl to stdOut"/>
     </action>
     <action>
       <execute_system_command value="perl testOut.pl" stdout="stdOut"/>
     </action>
     <action>
       <write_console value="This program has printed: \"({$root:stdOut})\""/>
     </action>
  </command>
</script>