OnPlotG.LST script file

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Event Scripts > Plot >

OnPlotG.LST script file

Description

It is executed when MechworksPDM is requested to plot a generic (i.e. no CAD) document.

This script is in charge of arranging all the tasks needed for a plotting, depending on the available drivers or the available tools.

Activation

Options→General→More...

Input

@DOCUMENT_PATHNAME

the full path name of the opened document

@DOCUMENT_FNAME

the file name part of the full path name

@DOCUMENT_FEXT

the file extension part of the full path name

@DOCUMENT_FDIR

the file directory part of the full path name

@DOCUMENT_UNIQUE_ID

when greater than 0, the unique Id of the opened document

Remarks

It is also expected that the database View for the class of document that is being plotted contains informations like the SHEET_SIZE or the SHEET_FORMAT, so to help in plotting; of course these data should have been added to the db by some auxiliary scripts or customized data inputs. The script can also read the plotting parameter files saved in the PAR sub-directory of the DBWorks installation, so to understand, for example, on which printer driver to plot the document, depending from the sheet size.

Example

.VBSCRIPT
Sub Main()
 DBWInit(TRUE)
 pathName = DBWInput("@DOCUMENT_PATHNAME")
 fname = DBWInput("@DOCUMENT_FNAME")
 fext = DBWInput("@DOCUMENT_FEXT")
 fdir = DBWInput("@DOCUMENT_FDIR")
 uid = DBWInput("@DOCUMENT_UNIQUE_ID")
 DBWMsgBox "OnPlotG:" & vbCrLf &_
  "Path Name=" & pathName & vbcrlf &_
  "fName=" & fname & vbcrlf &_
  "fext=" & fext & vbcrlf &_
  "fdir=" & fdir
End Sub


Using Command Lines with Acrobat and Acrobat Reader under Windows

You can display and print a PDF file using command lines with Acrobat and Acrobat Reader:

Syntax

AcroRd32.exe FileName

Executes the Reader and displays a file.

AcroRd32.exe /p FileName

Executes the Reader and prints a file.

AcroRd32.exe /t Path PrinterName DriverName PortName

Initiates Acrobat Reader, prints a file while suppressing the Acrobat print dialog box, then terminates Reader.

The four parameters of the /t option evaluate to path, printername, drivername, and portname (all strings).

Path

The path containing pdf files.

PrinterName

The name of your printer.

DriverName

Your printer driver’s name. Whatever appears in the Driver Used box when you view your printer’s properties.

PortName

The printer’s port. portname cannot contain any "/" characters; if it does, output is routed to the default port for that printer.

Example

This is an example of OnPlotG.LST script file that implements the above command line.
driverName and printerName are equals but not for a specific reason; it depends on the printer settings.

.VBSCRIPT

const AcrobatReaderApplication = "C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe"
const printerName = "hp officejet g series"
const driverName = "hp officejet g series"
const portName = "OfficeJetG95"
sub main()
        DBWInit(TRUE)
        pathName = DBWInput("@DOCUMENT_PATHNAME")
        fname = DBWInput("@DOCUMENT_FNAME")
        fext = DBWInput("@DOCUMENT_FEXT")
        fdir = DBWInput("@DOCUMENT_FDIR")
        uid = DBWInput("@DOCUMENT_UNIQUE_ID")
        if ucase(fext)=".PDF" then
                set wshShell = CreateObject("WScript.Shell")
                cmdLine =       """" & AcrobatReaderApplication & """" & " /t " &_
                                        """" & pathName & """" & " " &_
                                        """" & printerName & """" & " " &_
                                        """" & driverName & """" & " " &_
                                        """" & portName & """"
                DBWMsgBox cmdLine
                ok = wshShell.Run( cmdLine, 1, true )
                set wshShell = Nothing
        end if
end sub