GalepX Batch Mode


The remote bash script can be used for sending commands and scripts to GalepX under Linux. The IP environment variable is used for determining GALEP's IP address (default: Sending scripts is similar to the Windows version described below. The remote bash script, and all example GalepX scripts can be found in the examples.tar.bz2 archive in the remote subfolder.


TIP: The program remote.exe discussed in this tutorial is interchangeable with the console application remoteX.exe.
For new applications wie recommend to use remoteX.exe.

The remote.exe program can be used for sending scripts to GalepX under Windows, using a batch file, a shortcut, or the command prompt. remote.exe is located in the remote subfolder. For easy debugging, the GalepX socket communication is printed into the program's window. Alternatively, it can be printed into a log file.

Please note that remote.exe is only intended for batch control and demonstration purposes! For controlling GALEP programmers by software, you should of course send commands directly to the GalepX socket interface, rather than executing batch files. Using the remote.dll, it's very simple to implement all GALEP functions in any C++, Delphi, or Visual Basic software.

The remote subfolder also contains the lite-C source code of remote.exe (remote.c). Lite-C is an interactive application authoring system by Conitec and Atari, Inc., and can be downloaded free from

Command line options for remote.exe

The program can be called from a batch file, command shell, or shortcut with the following command line. The command line options must be ginven in the order as shown below, and GalepX must be started before.

remote.exe [scriptfile.gxs] [logfile.log] [-nwnd] [replacement1] [replacement2] [replacement3]

scriptfile.gxs  sends the script with the given filename to the GalepX program. The maximum size of the script is 10000 bytes. When the script filename is omitted, a default script is sent that lets all connected GALEP devices blink.

logfile.log  prints script output into the log file with the given filename, and exits the program when GalepX returns either "#01", "#00" or "Exitcode" (see below). If a log file is not given, all script output will be displayed in the program window.

-nwnd is a command line option that suppresses the script output in the program window, and exits the program at termination of the script.

replacement1  replaces all occurrences of the placeholder %1 in the script. Three placeholders %1, %2, %3 can be used in the script and replaced with file names etc. through the command line (see example below).

Command line options for remoteX.exe

The cmdline options are slightly different to remote.exe

Usage: remoteX [*.gxs] [*.log] [replace1] [replace2] [replace3] [options]

-v verbose output: Prints additional messages. Default is skript messages and errors(=E=) only.
--vd verbose debug output: Prints all messages.
--conoff Console messages off. Nothing will be printed on the screen.
--cto value Connection Timeout of value[ms]. Default is 1000ms.
--oto value Overall Timeout value[ms]. Default is endless (0ms).
--ip nnn.nnn.nnn.nnn IP Address.
--port nnnn Port number.
--version Shows version number.
--help Shows this help.

Script output interpretation

The following tokens in the script output have a special meaning in remote.exe:

#00 - Successful script termination. Exits the program with exit code 0 when a log file name or the -nwnd option was given in the command line.

#01 - Script error. Exits the program with exit code 1 when a log file name or the -nwnd option was given in the command line.

Exitcode[n] - Closes the program window and exits the program with exit code n (a number between 0 and 255). The exit code can be evaluated in a batch file through the ERRORLEVEL batch variable (see example below). This way the script can control the further execution of the batch file depending on error or success of the operation. If the script ends without printing "Exitcode", the program window stays open until it's manually closed.


The script "action.gxs" listed below loads a saved project, programs it, waits until programming is finished, then closes the program window and returns with exit code 0 or 1:

#include "gxAPI/gxBasic1.h"  

tGXImportFlags flags;
string sDocument = gxImportProject("%1",flags);
print(message("New created document is: \"%name%\".") << sDocument);

gxStartAction(sDocument, "saProgram");
while (true)
   int iState = gxGetDocumentState(sDocument);
   if (iState == 0)
   if (iState == 1)
     print(MTR("Busy / Algo active"));
   if (iState == 2)
      print(MTR("Finished: Success - Exitcode0"));
   if (iState == 3)
     print(MTR("Finished: Failed - Exitcode1"));

Command line: remote.exe action.gxs test.gxb

The script action.gxs is sent to GalepX's socket interface, and the "%1" placeholder in the script is replaced with "test.gxb" (the name of the saved project). remote.exe returns with an exit code 0 on programming success, and exit code 1 on failure. The exit code can be used in a batch file for triggering further actions through IF ERRORLEVEL... conditional branches.



► latest version online