|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Event Scripts > UserInterface > OnViewDWG.LST script file |
It is executed when selecting the command RMB → Open DWG/DXF Viewer from the project tree or from a grid.
Options→General→More...
@DOCUMENT_PATHNAME |
the DWG/DXF file name to be previewed |
@OKVIEW |
0: failure |
.VBSCRIPT
'
' assign here the path where the Free DWG Viewer executable can be found
'
const dwgviewerexe = "C:\Program Files\IGC\Free DWG Viewer\dwgviewer.exe"
sub main()
DBWInit(TRUE)
pathName = DBWInput("@DOCUMENT_PATHNAME")
dim fs
Set fs = CreateObject("Scripting.FileSystemObject")
ext = fs.GetExtensionName(pathName)
if lcase(ext) = "dwg" or lcase(ext) = "dxf" then
Dim shell
Set shell = CreateObject("WScript.Shell")
shell.Run( chr(34) & dwgviewerexe & chr(34) & " " & chr(34) & pathName & chr(34) )
DBWOutput "@OKVIEW","1",ForWriting
else
DBWOutput "@OKVIEW","0",ForWriting
end if
end sub