Miraplacid Text Driver Howto

1. How to print to Text Driver from DOS program?


To set up Miraplacid Text Driver to catch DOS text print job, you need to do the following:
  1. Share Text Driver on the network.
  2. On PC with your DOS program, create the following batch file:
    
    net use lpt1: /delete 
    net use lpt1: \\Your_Computer_Name\SharedPrinter 
    
  3. Run this batch file.
  4. Open Advanced Settings software.
  5. Set Datatype to TEXT and press OK.
  6. Because you will use Text Driver as a shared printer, you will not be able to work with MTD interactively, and will need to set up Text Driver to work in shared printer mode, as provided in recipes (2) and (3).
You should be able to print from a DOS program to LPT1. Try it out from EDIT, open a text file, and print it.

2. How to print to Text Driver from service or other program when nobody is logged in?


Normally, Text Driver core works in the same session as user printing application. This allows Text Driver to support correctly such personal folders as Profile, Desktop, My Documents, etc.
When you print to Text Driver as a shared printer, or print from some system service, print job will be initiated from SYSTEM user which does not have personal settings. So, in this case only Common Settings should be used.
Server-based printing means that you will need no User Interface.
To run Text Driver successfully in such a "server" environment, you need to:
  1. Launch Text Driver user interface from your desktop or program folder.
  2. Set all Text Driver options to desired values. Please, do not use personal folders in {{SYSFOLDER}} tag (for SYSTEM account).
  3. Set AutoSave checkbox to "ON" in System Options.
  4. If user who will print jobs does not have personal settings (for shared printers and printing from services), press "Save Common" button.
  5. Close user interface. The configuration will be saved.
In result, Text Driver will work in automatic mode, without user interface and under user who printed the print job.
If you will need to change configuration, just open user interface, make your changes and close it.

3. How to set up Text Driver to work as a network printer?


Like any other printer, Text Driver may be shared on a network by setting standard sharing properties in Printers/Printers and Faxes folder. You may install Text Driver on your network server, share it and choose any suitable name for this shared printer.
But, you will not be able to use Text Driver interactively, i.e., with User Interface. So, before you will start using Text Driver as a shared printer, you will need to change and save all necessary settings, and set AutoSave mode to ON to prevent User Interface component to start. After that, press "Save Common" button to save this configuration for all users.
However, you will not be able to use personal settings for this printer users - no personal folders, {{USER}} tags, etc, because Text Driver core will run under the same account (SYSTEM) for all users. Step-by-step instuctions available at recipe (2).
If you need to have personalized settings, or need to launch User Interface for your users, we recommend you to consider Terminal Server Edition.

4. How to send extracted text by email with Outlook?


You may use the following script file as a post-processor:

==================== outlook.js =================
var objArgs = WScript.Arguments;
if(objArgs.Count()<1) {
    WScript.Quit(1);
}
var fso = WScript.CreateObject("Scripting.FileSystemObject");

var text = fso.OpenTextFile(fso.GetAbsolutePathName(objArgs.Item(0)), 1);
var mtdtext=text.ReadAll();

var ol = WScript.CreateObject("Outlook.Application");
var msg = ol.CreateItem(0);

msg.Recipients.Add("user@company.com");

var success = msg.Recipients.ResolveAll();

msg.Subject = "New text from MTD";
msg.Body = mtdtext;

if(success) {
    msg.Send();
} else {
    msg.Display();
}
===================================================
Check "Open with" checkbox in File transport properties. Fill out "Open with" editbox with cscript.exe. In "Parameters" type outlook.js (with a full path to it).

Text printed by MTD must be in ANSI. If you need to open Unicode files, change

var text = fso.OpenTextFile(fso.GetAbsolutePathName(objArgs.Item(0)), 1);
to

var text = fso.OpenTextFile(fso.GetAbsolutePathName(objArgs.Item(0)), 1, false, true);

5. How to send extracted text by email with Collaboration Data Objects (CDO) messaging component (CDONTS.NewMail) ?


You may use the following script file as a post-processor:

==================== cdonts.js =================
var objArgs = WScript.Arguments;
if(objArgs.Count()<1) {
    WScript.Quit(1);
}
var fso = WScript.CreateObject("Scripting.FileSystemObject");

var text = fso.OpenTextFile(fso.GetAbsolutePathName(objArgs.Item(0)), 1);
var mtdtext=text.ReadAll();

var mail = WScript.CreateObject("CDONTS.NewMail");
mail.From="user1@company.com";
mail.To="user2@company.com";
mail.Subject="New text from MTD";
mail.Body=mtdtext;
mail.Send();
================================================
Check "Open with" checkbox in File transport properties. Fill out "Open with" editbox with cscript.exe. In "Parameters" type cdonts.js (with a full path to it).

Text printed by MTD must be in ANSI. If you need to open Unicode files, change

var text = fso.OpenTextFile(fso.GetAbsolutePathName(objArgs.Item(0)), 1);
to

var text = fso.OpenTextFile(fso.GetAbsolutePathName(objArgs.Item(0)), 1, false, true);