|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Event Scripts > Document > OnSave.LST script file |
It is executed every time a document is saved from the 3D CAD.
Options→Open/Save→Save
@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 |
@EVENT_TYPE |
0: (pre-event) the CAD file is still not saved; any modification on the active model, done by the script, will be saved |
@CALLED_FROM_CAD |
0: if called from a MechworksPDM save event |
The OnSave and OnSaveAs are called TWO times (one before the save, and one after the save) when using the DBWorks Save and SaveAs toolbar buttons.
The DBWOutput directives are disabled during the post event (@EVENT_TYPE=1) since the post event is intended only to allow specific actions on the file rather than on the database.
OnSaveAs.LST script file
.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")
bef_aft = DBWInput("@EVENT_TYPE")
cadSave = DBWinput("@CALLED_FROM_CAD")
if bef_aft=0 then
'this code is BEFORE the saving operation
'...
else
'this code in AFTER saving document
'...
end if
DBWMsgBox "OnSave:" & vbCrLf &_
"UID = " & uid & vbcrlf &_
"PathName = " & pathName & vbcrlf &_
"fdir = " & fdir & vbcrlf &_
"fName = " & fname & vbcrlf &_
"fext = " & fext & vbcrlf &_
"preEvent = " & bef_aft & vbcrlf &_
"called from CAD = " & cadSave
end sub