OnCreateHtmlOutput.LST script file

<< Click to Display Table of Contents >>

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

OnCreateHtmlOutput.LST script file

Description

This script is executed when pressing the Internet Explorer button in the Tree Page bottom bar.

Activation

It is executed if existing in the LST\SYSTEM folder.

Input

@DOCUMENT_UNIQUE_ID

root document uid

@TREE_FILE_PATH

full path name of the .TREE file to be used as input for the DBWTHTM html generator

@NODE_FILE_PATH

full path name of the .NODE file to be used as input for the DBWTHTM html generator

@MAIN_PAGE_TITLE

default title for the main page

@DEFAULT_OUTPUT_DIRECTORY

default output directory, as read from the HTM\DBW2HTM.PAR parameter file

Output

@OKHTML

0: fail
1: ok in creation of html pages

@DEFAULT_OUTPUT_DIRECTORY

chosen output directory [optional]

@MAIN_PAGE_TITLE

main page title [optional]

Example

.VBSCRIPT

Sub Main()
 DBWInit(TRUE)
 docUniqueId = DBWInput("@DOCUMENT_UNIQUE_ID")
 treeFilePath = DBWInput("@TREE_FILE_PATH")
 nodeFilePath = DBWInput("@NODE_FILE_PATH")
 mainPageTitle = DBWInput("@MAIN_PAGE_TITLE")
 defaultOutputDir = DBWInput("@DEFAULT_OUTPUT_DIRECTORY")
 DBWMsgBox _
  "Document Unique Id: " & docUniqueId & vbcrlf &_
  "Tree file path: " & treeFilePath & vbcrlf &_
  "Node file path: " & nodeFilePath & vbcrlf &_
  "Main page title: " & mainPageTitle & vbcrlf &_
  "Default Output dir: " & defaultOutputDir
 Set WshShell = CreateObject("WScript.Shell")
 on error resume next
 outputDir = WshShell.RegRead("HKCU\MechWorks\HTML\OutputDirectory")
 on error goto 0
 if outputDir = "" then
  outputDir = defaultOutputDir
 end if
 title ="Selelect the HTML output directory"
 outputDir = DBWSelectdir( outputDir, title )
 if outputDir = "" then
  DBWOutput "@OKHTML",0, ForWriting
  exit sub
 end if
 WshShell.RegWrite "HKCU\MechWorks\HTML\OutputDirectory", outputDir
 myTitle = InputBox("Assign a title for the main page:","Main page title", mainPageTitle)
 if myTitle = "" then
  DBWOutput "@OKHTML",1, ForWriting
  DBWOutput "@OUTPUT_DIRECTORY", outputDir, ForAppending
 else
  DBWOutput "@OKHTML",1, ForWriting
  DBWOutput "@OUTPUT_DIRECTORY", outputDir, ForAppending
  DBWOutput "@MAIN_PAGE_TITLE",myTitle,ForAppending
 end if
end sub