|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Programmer's Guide > $(.VBSCRIPT <script_name>) macros
|
You can execute a script for building the ID and the DESCRIPTION of a configured record, at the first save of the same.
The script name must be declared, with the prefix .VBSCRIPT, in the body of a macro of the Data Input Options Macro definition for configured record ID/DESCRIPTION. The value returned back from the script will be concatenated to other macros declared in the option.
@DOCUMENT_FILE_NAME |
the file name without directory and extension |
|---|---|
@DOCUMENT_CONFIGURATION |
the configuration |
@TEXT |
the text to be inserted in the ID or DESCRIPTION field |
Data Input option page:
Macro definition for configured record ID:
$(.VBSCRIPT myScript.LST)
An example of myScript.LST is the following; the example show how, depending from the first letter of the file name, the ID will have a prefix or not:
.VBSCRIPT
sub main()
fileName = DBWInput("@DOCUMENT_FILE_NAME")
configuration = DBWInput("@DOCUMENT_CONFIGURATION")
DBWMsgBox "File name: " & fileName & vbcrlf &_
"Configuration: " & configuration
if left(fileName,1)="A" then
DBWOutput "@TEXT", "01234" & fileName & " (" & configuration & ")",ForWriting
else
DBWOutput "@TEXT", fileName & " (" & configuration & ")",ForWriting
end if
end sub