|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Event Scripts > Document > OnSaveAs.LST script file |
It is executed every time a document is saved from the 3D CAD.
Please note that this script is executed at every SaveAs.
On the contrary, DATAENTR.LST is executed ONLY when running the DBWorks SaveWizard.
Options→Open/Save→Save as
@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 |
@SAVED_FROM_DOCUMENT_UNIQUE_ID |
the unique id of the document from which the Save As... action has been performed |
@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 the MechworksPDM saveAs button has been pressed |
The OnSave.LST and OnSaveAs.LST are now called two times (one before the save, and one after the save) when using the DBWorks Save and SaveAs toolbar buttons.
On the contrary, when using the SolidWorks Save or SaveAs, only pre-events will be handled, and so the two scripts are called only one time, before the phisical save of the file.
OnSave.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")
fromUid = DBWInput("@SAVED_FROM_DOCUMENT_UNIQUE_ID")
bef_aft = DBWInput("@EVENT_TYPE")
called_from_CAD = 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 "OnSaveAs:" & vbCrLf &_
"Path Name=" & pathName & vbcrlf &_
"fName=" & fname & vbcrlf &_
"fext=" & fext & vbcrlf &_
"fdir=" & fdir & vbcrlf &_
"OrigUid=" & fromUid & vbcrlf &_
"NewUid=" & uid & vbcrlf & _
"CalledFromCad=" & called_from_CAD
end sub