Write scripting files

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Programmer's Guide >

Write scripting files

.LST and .SPT files are script files written in VBScript.

They can be called by the dataform while editing.

.VBS files can be executed from Utility menu in the DBWorks toolbar too.

Please pay attention to few rules that are necessary to correctly execute your scripts.

The file must be placed in the "\lst" DBWorks directory.

The first line must contain only the string ".VBSCRIPT"

It must contain "Sub Main()" routine (other functions and subroutines are optional)

It is possible to set or to retrieve information to/from other data fields in the same dataform. You can do it calling    and   functions.

 

See also

 

Example

.VBSCRIPT

'-------------------------------------------------------------------------------------
Sub Main()
 xlsDocument = DBWInput("@XLS_DOCUMENT")
 'DBWMsgBox ".XLS Document:" & xlsDocument
 Set MyXL = GetObject(xlsDocument)
 MyXL.Application.Visible = True
 MyXL.Parent.Windows(1).Visible = True
 ' Do manipulations of your
 ' file here.
 ' ...
 'MyXL.Application.Quit
 Set MyXL = Nothing 'Release reference to the application and spreadsheet.
End Sub