87 lines
2.5 KiB
Plaintext
87 lines
2.5 KiB
Plaintext
Option Explicit
|
|
|
|
Const DX_PART_REPLACE_TAG = "DX_PRODUCTIVITY_PART_REPLACE"
|
|
Dim DxMenuModulesLoaded
|
|
|
|
Sub DxInstallPartReplacementMenu()
|
|
Dim Bar
|
|
Dim Controls
|
|
Dim Index
|
|
Dim Existing
|
|
Dim Control
|
|
Set Bar = CommandBars("Sheet Menu Bar")
|
|
Set Controls = Bar.Controls
|
|
For Index = Controls.Count To 1 Step -1
|
|
Set Existing = Controls.Item(Index)
|
|
If Existing.Tag = DX_PART_REPLACE_TAG Then Existing.Delete
|
|
Next
|
|
Set Control = Controls.Add(10, , , , True)
|
|
Control.Tag = DX_PART_REPLACE_TAG
|
|
Control.Caption = "Dx Productivity"
|
|
DxAddAction Control.Controls, "Part replacement probe", _
|
|
"DxPartReplacementMenuProbe"
|
|
DxAddAction Control.Controls, "Inventory current project", _
|
|
"DxPartReplacementMenuInventory"
|
|
DxAddAction Control.Controls, "Continue part replacement", _
|
|
"DxPartReplacementMenuContinue"
|
|
End Sub
|
|
|
|
Sub DxAddAction(ByVal Controls, ByVal Caption, ByVal MacroName)
|
|
Dim Control
|
|
Set Control = Controls.Add(1, , , , True)
|
|
Control.Caption = Caption
|
|
Control.OnAction = MacroName
|
|
End Sub
|
|
|
|
Function DxMenuHome()
|
|
DxMenuHome = CStr(Scripting.GetEnvVariable("DXTOOLS_HOME"))
|
|
If Len(DxMenuHome) = 0 Then
|
|
Err.Raise vbObjectError + 795, "DxMenuHome", _
|
|
"DXTOOLS_HOME is not configured"
|
|
End If
|
|
End Function
|
|
|
|
Sub DxMenuLoad(ByVal FileName)
|
|
Dim Fso
|
|
Dim Home
|
|
Dim Text
|
|
Home = DxMenuHome()
|
|
Set Fso = CreateObject("Scripting.FileSystemObject")
|
|
Text = Fso.OpenTextFile(Home & "\integration\dxdesigner795\" & _
|
|
FileName, 1, False, 0).ReadAll
|
|
ExecuteGlobal Text
|
|
End Sub
|
|
|
|
Sub DxMenuLoadModules()
|
|
If DxMenuModulesLoaded Then Exit Sub
|
|
DxMenuLoad "BridgeCommon.vbs"
|
|
DxMenuLoad "PartReplaceProbe.vbs"
|
|
DxMenuLoad "PartReplaceBridge.vbs"
|
|
DxMenuLoad "PartReplaceMenuRuntime.vbs"
|
|
DxMenuModulesLoaded = True
|
|
End Sub
|
|
|
|
Sub DxPartReplacementMenuProbe()
|
|
Dim Request
|
|
DxMenuLoadModules
|
|
Request = "{""disposable_project_marker"":false," & _
|
|
"""format_version"":1,""operator_confirmation"":false}" & vbLf
|
|
DxWriteUtf8Atomic DxMenuHome() & _
|
|
"\runs\menu-probe-request.json", Request
|
|
DxRunPartReplaceProbe "runs\menu-probe-request.json", _
|
|
"runs\menu-compatibility-profile.json"
|
|
End Sub
|
|
|
|
Sub DxMenuBridge(ByVal MenuAction)
|
|
DxMenuLoadModules
|
|
DxPartReplaceMenuDispatch MenuAction
|
|
End Sub
|
|
|
|
Sub DxPartReplacementMenuInventory()
|
|
DxMenuBridge "inventory"
|
|
End Sub
|
|
|
|
Sub DxPartReplacementMenuContinue()
|
|
DxMenuBridge "continue"
|
|
End Sub
|