Parameters > Citect.ini File Parameters > CtEdit Parameters > [CtEdit]CompileUnsuccessfulCommand

[CtEdit]CompileUnsuccessfulCommand

Indicates to the compiler an optional command, script or batch file to execute after an unsuccessful compile. Generally this would be used to create a log file to show warnings or errors generated during a compile. To execute an optional application, script or batch file to execute after a successful compile use the parameter [CtEdit]CompileSuccessfulCommand

Allowable Values: Any valid command line containing replacement strings that represent possible information that the compiler can provide, including such information as project name, project path, INI path, bin path, etcetera. Enclose the replacement strings in ‘%’ characters, similar to DOS batch file notation.Use the escape character “^” if you want to include the ‘%’ character literally.

Allowable replacement strings

Replacement Strings Description
CtEnvBinPath Path to the Bin folder of CitectSCADA
CtEnvConfigPath Path to the config folder
CtEnvDataPath Path to data folder
CtEnvIncludeProjects List of include projects for the project being compiled
CtEnvErrors Number of errors encountered during compile
CtEnvIncludeProjectPaths List of the directory paths of the include projects for the project being compiled, in the same order as the projects are listed in CtEnvIncludeProjects
CtEnvIniPath Path to the ini file
CtEnvLogPath Path to log files
CtEnvProject Name of the project that is being compiled
CtEnvProjectPath Path to the project file that is being compiled

If an undefined replacement strings is specified in the command line a compiler warning will be generated, and the application will not be called. Compiler warnings will also be generated if the compiler does not execute the command line successfully. However, any errors that occur when the command is executing will not be logged, as they will not be known to the compiler.

Example:

This could be a notification - such as sending an email or network message to a person - or just a log entry to a text file as shown below:

  1. Create a text file with the following content:
 
Echo %Date% %Time% '%CtEnvProject%' Compilation unsuccessful, [%1] >> "%CtEnvLogPath%\Log.txt"
 
  1. Save the file as a command / batch file, example 'MyError.cmd'
  2. Set the INI parameter to run the above file, including the path to where the file was saved. Pass the list of include projects as the first parameter to the command file.
 
CompileUnsuccessfulCommand=C:\Temp\MyError.cmd "%CtEnvIncludeProjects%"
 

A Log,txt file will be created and updated each time a project compile is unsuccessful.

The replacement strings can be used directly in the INI parameter value and t can be accessed as application environment variables. The example demonstrates this method.

See Also