Miraplacid Home Contact UsStoreDownloadsMiraplacid NewsMiraplacid ForumSearch at Miraplacid.com
Miraplacid Publisher (Image Printer Driver)Miraplacid Text Driver (Text Printer Driver)Miraplacid Data ViewerMiraplacid Form
Bookmark this pageMiraplacid PublisherMiraplacid Text DriverMiraplacid Data Viewer / Binary DOMMiraplacid Company

Miraplacid Text Driver 4.1 Scripting Manual

 

Miraplacid Text Driver 4.1 Scripting Manual

Scripting and Programming Support with Miraplacid Text Driver


Miraplacid Text Driver registers itself as an ActiveX object and could be used from any scripting and OLE-compliant software.
Using this ability, you can control the printing process directly from your script or application.

Miraplacid Text Driver Scripting Object Creation

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")
where myscript.vbs is your script name (see sample scripts below)
Unregistered version of Miraplacid Text Driver shows registration dialog, so bat file might open the Word document before you click "Continue". Add WScript.Sleep(5000) at the beginning of your script file to synchronize it.

Appendix A: Object Miraplacid.TextDriver


Property Type Description
plugin_id long Select plug-in ("Output Style").
0 - Text with Layout
1 - XML
2 - Plain Text
charset long Character set (codepage number)
5 - UNICODE
437 - OEM American DOS
850 - OEM Latin-1 DOS
852 - OEM Eastern Europe DOS
866 - OEM Cyrillic DOS
932 - Japanese
936 - Chinese (Simplified")
949 - Korean
950 - Chinese (Traditional)"
1250 - ANSI Latin-1 Windows
1251 - ANSI Cyrillic Windows
1252 - ANSI Eastern Europe Windows
1257 - ANSI Baltic Windows
...etc...
unix_eol long (get, put) End Of Line style
0 means "Windows" EOL style (\r\n or 0x0D, 0x0A)
1 means "UNIX" EOL style (\n or 0x0A)
autosave long 0 - interactive mode; 1 - Process and Auto-send to the specified destinations
delim BSTR Delimiter string for Plain Text plug-in

Miraplacid Text Driver Send To (Transport plug-ins) parameters


To query or modify Transport plug-in parameters, use TransportParam property of Miraplacid Text Driver object.
obj.TransportParam("File","filename")="textout_{{PAGE}}.txt"

File
Property Type Description
path String Destination File Path. {{PAGE}}, {{JOB}}, {{IDENTITY}}, {{DATE}}, {{TIME}} supported.
filename String Destination File Name. {{PAGE}}, {{JOB}}, {{IDENTITY}}, {{DATE}}, {{TIME}} supported.
open Number Opens result image file with post-processor.
hide Number 0 = show post-processor window. 1 = hide post-processor window. Ignored if open=0.
exec String Post-processor filename with full path. Ignored if open=0.
param String additional parameters for post-processor. Ignored if open=0.
setfilename Number Set it to 0 if you wish to specify filename. Set it to 1 if you Miraplacid Text Driver to use original document name as a file name. Ignored if open=0.
append Number Set it to 0 if you wish to overwrite resulting file. Set it to 1 if you wish to append current result to a previous file.
FTP
Property Type Description
url String Destination FTP directory URL.
file String Destination File Name. {{PAGE}}, {{JOB}}, {{IDENTITY}}, {{DATE}}, {{TIME}} supported.
passive Number 0 = FTP passive mode OFF. 1 = FTP passive mode ON.
user String FTP server username.
password String FTP server password.
HTTP
Property Type Description
url String Destination HTTP URL.
file String Destination File Name.
put Number 0 = use POST method. 1 = use PUT method.
user String username.
password String password.
Printer
Property Type Description
printer Number Printer number. Depends on printers installed in your system. Please start Miraplacid Publisher and check Printer drop-down for Send To: Printer. First printer will have index 0, second - index 1 and so on.
font Number 1 - use default font. 0 - select custom font.


You can change the default font by changing the file font.ini.

Font.ini
Key Description
Facename String that specifies the name of the font.For example "Arial".
Charset The possible significances of this key were described above.
Strikeout Specifies a strikeout font if set to 1.
Underline Specifies an underlined font if set to 1.
Height Specifies a height for a font with a specified point size.
Italic Specifies an italic font if set to 1.
Weight Specifies the weight of the font in the range 0 through 1000.The following values are defined for convenience.

0 - DONTCARE
100 - THIN
200 - EXTRALIGHT
300 - LIGHT
400 - NORMAL
500 - MEDIUM
600 - SEMIBOLD
700 - BOLD
800 - EXTRABOLD
900 - BLACK

Appendix B: Sample script on VBScript


'
' Miraplacid Text Driver 4.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"

set prn = WScript.CreateObject("Miraplacid.TextDriver")


prn.autosave=1;  // Turn AutoSend ON
prn.charset=5;   // Unicode
prn.unix_eol=0;  // Windows eof
prn.plugin_id=2; // Set plug-in
prn.delim="zzz"; // delimiter string

prn.Transport="FTP,HTTP,File";                                       // Set transport plug-in	
prn.TransportParam("FTP","url")="ftp://main";                        // Set URL for FTP	
prn.TransportParam("FTP","file")="Page_{{PAGE}}";                    // Set filename for FTP	
prn.TransportParam("FTP","user")="name";                             // Set username for FTP	
prn.TransportParam("FTP","password")="pass";                         // Set password for FTP	
prn.TransportParam("HTTP","url")="http://testasp.loc/puts";          // Set URL for HTTP
prn.TransportParam("HTTP","file")="Page_{{PAGE}}";                   // Set filename for HTTP
prn.TransportParam("HTTP","user")="name";                            // Set username for HTTP	
prn.TransportParam("HTTP","password")="pass";                        // Set password for HTTP
prn.TransportParam("HTTP","put")=1;                                  // Set Put method for HTTP
prn.TransportParam("File","setfilename")=0;                          // Set custom filename
prn.TransportParam("File","append")=1;                               // Set append method
prn.TransportParam("File","path")="c:\\doc_{{DATE}}";                // Set directory for File	
prn.TransportParam("File","filename")="Page_{{PAGE}}";               // Set filename for File


' Print Word document:
word.ActiveDocument.PrintOut

' Close Word document
word.ActiveDocument.Close
word.Quit
prn.Stop();

Appendix C: Sample script on JScript


//
// 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";

prn = WScript.CreateObject("Miraplacid.TextDriver");

prn.autosave=1;  // Turn AutoSend ON
prn.charset=5;   // Unicode
prn.unix_eol=0;  // Windows eof
prn.plugin_id=2; // Set plug-in
prn.delim="zzz"; // delimiter string

prn.Transport="FTP,File";			  	    // Set transport plug-in	
prn.TransportParam("FTP","url")="ftp://main";	  	    // Set URL for FTP	
prn.TransportParam("FTP","file")="Page_{{PAGE}}"; 	    // Set filename for FTP	
prn.TransportParam("FTP","user")="name";	  	    // Set username for FTP	
prn.TransportParam("FTP","password")="pass";	  	    // Set password for FTP	
prn.TransportParam("File","path")="c:\\doc_{{DATE}}";	    // Set directory for File	
prn.TransportParam("File","setfilename")=0;	             // Set custom filename 
prn.TransportParam("File","append")=1;                     // Set append method
prn.TransportParam("File","filename")="Page_{{PAGE}}";	    // Set filename for File
prn.TransportParam("File","open")=1;	   		    // Set Postprocessor
prn.TransportParam("File","exec")="notepad.exe";	    // Set Postprocessor name
prn.TransportParam("File","hide")=0;	 	             // Set visible window


// Print Word document:
word.ActiveDocument.PrintOut();

while (0 == (prn.job_status & 4)) {
	WScript.Echo("Waiting for Start... "+prn.job_status); 
	WScript.Sleep(500);
}

while (0 != (prn.job_status & 4)) {
	WScript.Echo("Waiting for End... "+prn.job_status);
	WScript.Sleep(500);
}

WScript.Echo("Done");

// Close Word document
word.ActiveDocument.Close();
word.Quit();
prn.Stop();

Appendix D: PostProcessing:


You can setup Miraplacid Text Driver 4.1 to launch an application to handle the results of text generation process.
Select Send To: File, check "Open with" checkbox and specify post-processor application.
For example, you can execute notepad.exe,using the following settings:


path: "c:\"
filename: "textout.txt"
Open With: "notepad.exe"
Parameters: ""


Quotation marks are necessary when file name or path contains space characters.
Or, you can set up a viewer to open result text file for every printed page.You must add tag {{PAGE}} in filename textbox.

path: "c:\"
filename: "textout{{PAGE}}.txt"
Open With: "notepad.exe"
Parameters: ""


Notice that applications and files you use in post-processing should be specified with full path.

See also:

Copyright © 2001 - 2024 by Miraplacid.  Legal Notices