OnUpdateDatabaseForOpenedDocument.LST script file

<< Click to Display Table of Contents >>

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

OnUpdateDatabaseForOpenedDocument.LST script file

available from build: 20041222

Description

It is executed before and after the database is updated for an opened CAD or generic document,

like when saving a model in NEW state,
or when SHIFT + REFRESH refresh a checked-out model,
or when checking-in an opened checked-out model.

Location

LST folder

Activation

Options→General

Remarks

The purpose of the script is to let the programmer to be able to change/restore the state of the CAD model before it is processed by the database ( for example, it can switch the current configuration to a different one and then restore it with the post event ).

In order to improve the performance of the script you can use the .UIVbs version. The system checks first for the existence of the LST\OnUpdateDatabaseForOpenedDocument.LST script and then, if not found, it checks for the existence of the LST\OnUpdateDatabaseForOpenedDocument.UIvbs.

See more information on .UIvbs script here.

Input

@CONTEXT

UPDATE
CHECKIN

@EVENT_TYPE

0: pre-event
1: post-event

@CANCELED

0:if the button Cancel has been pressed in the Data Input form
1:otherwise

@DOCUMENT_PATHNAME

full path name of the document

@DOCUMENT_FNAME

file name of the document

@DOCUMENT_FEXT

file extension of the document

@DOCUMENT_FDIR

file folder of the document

@DOCUMENT_UNIQUE_ID

0: if the document does not already exist
unique ID of the document: otherwise

Example

.VBSCRIPT

sub main()
 DBWInit(TRUE)
 context = DBWInput("@CONTEXT") ' UPDATE | CHECKIN
 eventType = DBWInput("@EVENT_TYPE") ' 0 (pre-event) | 1 (post-event)
 canceled = DBWInput("@CANCELED") '1 if operation canceled by the user ( only valid with @EVENT_TYPE=1 )
 pathName = DBWInput("@DOCUMENT_PATHNAME")
 fName = DBWInput("@DOCUMENT_FNAME")
 fExt = DBWInput("@DOCUMENT_FEXT")
 fDir = DBWInput("@DOCUMENT_FDIR")
 uniqueId = DBWInput("@DOCUMENT_UNIQUE_ID") ' unique Id
 DBWMsgBox "context=" & context & vbcrlf & "event type=" & eventType & vbcrlf &_
 "path name=" & pathName & vbcrlf & "unique ID=" & uniqueId & vbcrlf &_
 "canceled=" & canceled
end sub