I need to automate a complex task. For that I have designed an Instrument Panel using the Add-In.
I now need to access some ValueEdit-items from a .pem-script file, but I can't get access to it.
Here is what I have done so far.
Code: Select all
Sub GetInstrumentPanel()
'DESCRIPTION: Find instrument panel
PrintToOutputWindow "GetInstrumentPanel - start"
Dim panel
Dim panel2
Set panel = Documents.Item("PanelTest1.ipf") ' This is the caption of the InstrumentsPanel created before.
Set panel2 = Documents.Add(peDocumentKindInstrumentsPanel) ' This is an example from the help file "Instruments Panel Documentation"
PrintToOutputWindow panel.Name
PrintToOutputWindow panel.Kind
PrintToOutputWindow panel.Type
PrintToOutputWindow panel2.Name
PrintToOutputWindow panel2.Kind ' prints {DFAFFAC0-2F50-428E-824C-B97089CD5F3F} - so it is an IntrumentsPanel - right?
PrintToOutputWindow panel2.Type
PrintToOutputWindow panel2.Scenes.Count ' throws exception: Das Objekt unterstützt dies Eigenschaft oder Methode nicht.: 'panel2.Scenes' - so it is not an InstrumentsPanel
PrintToOutputWindow "GetInstrumentPanel - finished"
End Sub
EDIT:
I think I found it! Refactored code for reference
Code: Select all
Sub GetInstrumentPanel()
'DESCRIPTION: Find instrument panel
PrintToOutputWindow "GetInstrumentPanel - start"
Dim doc
Dim panel
Set doc = Documents.Item("PanelTest1.ipf") ' This is the caption of the InstrumentsPanel created before.
Set panel = doc.ActiveWindow.Object ' This is doing the trick, without this you just have a doc-object instead of an IntrumentsPanel-object
Set scene = panel.ActiveScene
PrintToOutputWindow doc.Name
PrintToOutputWindow doc.Kind
PrintToOutputWindow doc.Type
PrintToOutputWindow "Scenes: " & panel.Scenes.Count
PrintToOutputWindow "GetInstrumentPanel - finished"
End Sub