Files
yiyezhqiu-refactored/integration/dxdesigner795/LoadMenu.vbs
T

24 lines
728 B
Plaintext

' Request the current DxDesigner host to execute the generated menu script.
' This external adapter only forwards a command; design APIs run in the host.
Option Explicit
Dim app, path, errorText
If WScript.Arguments.Count <> 1 Then WScript.Quit 2
path = WScript.Arguments(0)
If Not CreateObject("Scripting.FileSystemObject").FileExists(path) Then WScript.Quit 2
On Error Resume Next
Set app = GetObject(, "ViewDraw.Application")
If Err.Number <> 0 Or app Is Nothing Then
Err.Clear
WScript.Quit 3
End If
Err.Clear
app.ExecuteCommand "run " & Chr(34) & path & Chr(34)
If Err.Number <> 0 Then
errorText = Err.Description
Err.Clear
WScript.Echo errorText
WScript.Quit 1
End If
On Error GoTo 0
WScript.Quit 0