Developer Documentation Library > Scripting > mrPrePro preprocessor > Running mrPrePro
 
Running mrPrePro
You can run the mrPrePro preprocessor from a script. For an example of this, see Example 9: Running one mrScriptBasic script from another.
You can also run mrPrePro from a program. mrPrePro is implemented as a COM component called “SPSS PreProcessor 1.0 Type Library” and a .NET assembly called MRPREPROLib, which are both installed with the UNICOM Intelligence Data Model. After you have added a reference in your project to one of these components, you can run mrPrePro using code such as the following C#.NET 2.0 example:
// Create an mrPrePro object...
MRPREPROLib.CPrePro mrPrePro = new MRPREPROLib.CPrePro();

// Get the source file to be preprocessed...
String sFile = "";
String sSource = "";
try
{
  System.IO.StreamReader SourceFile = new System.IO.StreamReader(sFile);
  sSource = SourceFile.ReadToEnd();
}
catch { MessageBox.Show("Can't read file:\n\n" + sFile, "mrPrePro"); }

// Set the mrPrePro command line options...
String sParams = "-z --c99";

Object oMessage = new Object();
Object oResult = new Object();

// Run mrPrePro...
try { oResult = mrPrePro.Run(sSource, sParams, out oMessage); }
catch { }

// Display the output...
MessageBox.Show("Result:\n\n" + oResult.ToString()+ "\n\nMessage:\n\n" + oMessage.ToString(), "mrPrePro");
See
mrPrePro options
mrPrePro preprocessor