Checking if an optional panel is open

The View > Optional Panels menu lists the optional panels of the current layout. In the default layout, this includes the main command panel (MCP), the timeline, time range slider, and the Main Shelf.

To check if a panel is open, get the panel from the ActiveLayout.Views collection and check whether it’s visible:

LogMessage( Application.Desktop.ActiveLayout.Views("main_shelf").Visible );