To create component, use following constructions
- JScript:
var obj = WScript.CreateObject("Miraplacid.TextDriver");
- VBScript:
set obj = WScript.CreateObject("Miraplacid.TextDriver")
- Visual Basic:
Set obj = CreateObject("Miraplacid.TextDriver")
To enable early binding, you have to check
"mtd_core 3.1 Class Library" in "Project References" dialog and insert the following code:
Dim obj As Miraplacid.TextDriver
Set obj = CreateObject("Miraplacid.TextDriver")
'
' Miraplacid Text Driver 3.1 :: Printing from MS Word Example (VBScript)
'
set word = WScript.CreateObject("Word.Application")
word.Visible=1
word.Documents.Open("hello.doc")
word.Documents("hello.doc").Activate()
' Get active printer name
'WScript.Echo("Printer: '"+word.ActivePrinter+"'");
word.ActivePrinter="Miraplacid Text Driver on MTD"
set prn = WScript.CreateObject("Miraplacid.TextDriver")
prn.filename="c:\\worddoc.txt" ' Set Output Filename
prn.plugin_id=2 ' Set Plugin
prn.writemode=1 ' Append
prn.charset=5 ' Unicode
prn=0
' Print Word document:
word.ActiveDocument.PrintOut
' Close Word document
word.ActiveDocument.Close
word.Quit
//
// Miraplacid Text Driver :: Printing from MS Word Example (JScript)
//
word = WScript.CreateObject("Word.Application");
word.Visible=1;
word.Documents.Open("hello.doc");
word.Documents("hello.doc").Activate();
// Get active printer name
//WScript.Echo("Printer: '"+word.ActivePrinter+"'");
word.ActivePrinter="Miraplacid Text Driver on MTD";
prn = WScript.CreateObject("Miraplacid.TextDriver");
prn.filename="c:\\worddoc.txt"; // Set Output Filename
prn.plugin_id=2; // Set Plugin
prn.writemode=1; // Append
prn.charset=5;// Unicode
prn=null;
// Print Word document:
word.ActiveDocument.PrintOut();
// Close Word document
word.ActiveDocument.Close();
word.Quit();
MTD_UI.exe supports following command line parameters:
Parameter |
Description |
/Hidden |
Hide Miraplacid Text Driver dialog. You can show it back via tray icon menu. |
/AutoSave |
Turn Auto-Save mode on |
It is possible to start an external application to process the result text file.
Start Regedit.exe (we do it with "Run..." dialog in Start menu - just type "regedit")
then open registry key
HKEY_LOCAL_MACHINE/SOFTWARE/Miraplacid/TextDriver
and add string value "Postprocessor". Specify the application you want to start.
Specified application will be started with text file name as a parameter.
For example, "Postprocessor" = "Notepad" will open result text file in Notepad.
To start the postprocessor for each page just add {{PAGE}} to output filename.
Each page will be saved to individual file. postprocessor will be called for each file.
If all the pages are saved to a single file, postprocessor will be called once per document.