Execute Program

The Execute Program module will execute a windows based program and allow you to interact with it using the stdin and stdout pipes. This module allows you to command external programs whose source may not be accessible and does not provide for any API means of communication.

Most DOS based programs read input from the stdin pipe and write output to the stdout pipe. By specifying the text to send to the stdout and creating a parsing format to read the output text you can read and write information to the external program.

For example, below you can see the interface needed to execute the DOS cmd.exe and issue a "date" command and read in the return value.



1. Program File - Specify the program file to run

2. Program Arguments - Specify any arguments that are passed on the command line to the program. Note that you can use RoboRealm variables by specifying [variable_name] surrounded by []'s

3. Wait for program exit - wait for the termination of the program before continuing to the next processing cycle.

4. Console - you will see the programs output in the console area as would be printed to the stdout (command console) when running that application. This shows the current values being read from the program and provides a log of the ongoing communication activities. The green text is from RoboRealm, the red text are characters received and the green text are characters sent by RoboRealm to the device. To copy the log click on the Copy button, likewise to clear it click on the Clear button. Note that the console log only shows several lines at a time with older information being discarded.
You can switch the output to various formats for better viewing:

ASCII - shows the data as ASCII characters. Any character outside of printable characters will be represented with a \ followed by the actual integer data that was read

Decimal - shows the data as sets of single byte integer numbers

Hexadecimal - shows the data as sets of hexadecimal numbers (base 16 numbers, e.g. FF)

Short Binary - shows the data as binary numbers with prefix 0's removed

Binary - shows the data as sets of single byte binary numbers

5. Send Now - often you need to quickly test the application by sending a certain sequence of characters. To do so just type in the character sequence (using for carriage return, [image_count] for variables, etc.) and click on Send Now. The text will be parsed and sent to the program and the response will then appear in the console log. Note that this is different from the send sequence which will be sent each time the module is encountered in the processing pipeline. The Send Now button is a manual testing mechanism meant for debugging purposes. Also note that the returned text will be parsed by the Receive Sequence so that you can test your parsing code and see if the variables have been created. Use the Watch Variables module to see those variables being created.

6. Refresh Rate - to slow the scrolling of output select a different refresh rate for the console. This will just slow down how quickly RoboRealm reads information from the application.

7. Initialization Sequence - The initialization data sequence sends the provided string to the program on initialization of communication. You may want to use this to command the custom application into a specific mode ready for communication with RoboRealm. This initialization sequence is sent each time the communication is reset. This happens when you click on the "Stop" button in this interface, change one of the above parameters (Baud, Port, etc) or when the RoboRealm starts running for the first time. It is NOT sent when the Run button in the main RoboRealm interface is toggled. See the Text Formats page for additional information about the text string format.

8. Send sequence - Used to enter commands sent per pipeline loop (i.e. image processed) by RoboRealm. You can use this sequence to transmit variables created by other RoboRealm modules to the program. Each time an image is captured and processed the Execute Program module will interpret the Send Sequence text and send the result to the program. See the Text Formats page for additional information about the text string format.

9. Enable - Allows you to temporarily disable sending text to the program while performing edits. Note that the Send Sequence textarea will turn red to indicate this setting.

10. Send Rate - Some applications cannot handle data rapid streams. Use this dropdown to select how quickly you want the data to be sent. At AFAP (As Fast As Possible) the data will be sent out about 30 times a second (this assumes a camera running at 30 fps).

11. Send only on change - If your data does need to be sent out to your program every iteration through the processing pipeline loop this selection will prevent the same data from being sent to the program that was last sent. This is also an elegant way to reduce the data bandwidth to the program if your sequence does not change rapidly.

12. Receive sequence - used to receive and parse text send from the program. The text string is matched against the incoming bytes. When a match is found variables are added into RoboRealm for use in other modules. Reading into variables just requires adding in a variable at the appropriate spot within the receive string similar to the scanf routine in C/C++. The Receive sequence works similar to an expect string, i.e. you need to specify patterns that match the incoming text and substitute the areas that need to be fed into variables with the [ variable_nane ] format. Note that even if you are missing one space or newline the patter will not match and the variable will be zero or blank. See the Text Formats page for additional information about the text string format.


For an example of how to write a program using the Execute Program module you can download the Plugins.zip file. You will find a Console folder in there with an example program on how to write an Execute Program. The example program will receive input from RoboRealm and write whatever it receives (terminated by a newline) to the file "c:\temp\log.txt".

The "Stdin Send" text would then be

to cause that program to write the COG variables to disk (this assumes you have inserted the COG module somewhere in the pipeline. Note that the "Program File" would need to be something like


Quick Example

Create a file called c:\temp\test.bat with the following one line:

@echo test text
which will print "test text" to the console. Then run this  robofile and edit the Watch_Variable module to see the variable "test" contain the contents being printed in that .bat file.

Do you see the flashing black box? That is the .bat file being run each time and then executing.

See Also

Pipe Program
VBScript Program

 New Post 

Execute_Program Related Forum PostsLast postPostsViews
importing variables into roborealm
i have generated an executable file of a python code.then i called that .exe file from roborealm using EXECUTE_PROGRAM. i need t...
4 years 14 1170
Running PowerShell scripts in RR
Hi STeven, Does RR support running the .ps1 file type? It would be interesting to enable RR to mani...
6 years 6 1179
Need help sending data from SEI Explorer to RR
I am using a digital encoder from US Digital and their SEI Explorer software to measure the x,y movement of my camera mounted on...
10 years 4 2093
is it possible to execute a ms-dos batch file (*.bat) from roborealm?  ...
10 years 3 2260