How to open panel window without command ID?

I already asked similar question and for that specific case it worked. But I would like to get it open just by having an ID of the panel.

Currently I tried to get full panels list, find specific panel I need by ID, change its visible & obscured states and set whole list back, but this doesn’t work - after I set the list and try to get it again, panel still has visible: false, obscured: false

const showPanel(panelID) {
    let panels = getAppProperty("panelList")[0].panelList ?? []

    panels = panels.map(panel => {
        if (panel.ID !== panelID) {
            return panel
        }

        return {...panel, visible: true, obscured: false}
    })

    const command = {
        _obj: "set",
        _target: [{_ref: "panelList"}],
        to: panels,
    }

    execModal(() => bp([command]), {})
}

Is there a way to show a panel without a command?

Hi @Karmalakas,

Unfortunately the only way is via commands right now. You can make another panel visible by using batchPlay and finding the panel then invoking the menu command for the panel.

Best,
Amanda

Unfortunately I don’t think I can use this approach. Mainly for 2 reasons:

  1. panelList gives much more panels, than I can find in menu
  2. 3rd party plugin panels all have negative IDs, which AFAIK are subject to change unexpected and I need command IDs to stay constant to have them saved and assigned to buttons

You can check for and find the panel using panelList as you are already. However, if you want to open the other panel you must find the command and run this: performMenuCommand(panel.command) .

By defining a “panel” type entrypoint, Photoshop will automatically add a menu item for your plugin with the name defined in the label field, based on locale. When menu item is clicked, Ps loads the main field in manifest for the contents of the panel. So having negative IDs won’t be a problem because you can search for them by the label you defined.

7200 in the code example refers to part of the menu bar that contains the plugins, and you can pass in pluginName and panelName from what you found in panelList.


const plugins = menuBar.submenu.find(item => item.menuID === 7200)
  const plugin = plugins.submenu.find(item => item.title === pluginName)
  const panel = plugin.submenu.find(item => item.title === panelName)
  const panelState = getAppProperty('panelList').find(p => p.name === panelName)
  if (!panelState.visible || panelState.obscured || closeIfOpen) {
    performMenuCommand(panel.command)
  }

I’ll try to explain with specific examples

There’s this panel from panelList

{
  ID: "panelid.static.options"
  name: "Brush Options"
  obscured: false
  visible: true
  _obj: "panelList"
}

It’s not in the menu. I assume in the menu it’s named Brush Settings, but panel list says it’s visible, although all panels are closed when I test this. How do I find this panel by name, if names do not match? If it’s even that same panel

Another example. There’s this third party panel:

{
  ID: "panelid.dynamic.swf.csxs.LogiOptionsAdobe"
  name: "LogiOptions version 8.40.28"
  obscured: false
  visible: false
  _obj: "panelList"
}

This one is nowhere in the menu. How do I open this one?

There are few other similar examples, but I hope you see what I mean. It’s not necessarily my panel I want to open

If the panel you’re trying to call is written using CEP (which the LogiOptions one is because CSXS is the API we use for interapplication communication in legacy extensibility), then you won’t find it in the panel list. Instead, you should be able to find it in “Window > Extensions (legacy)” in the menu bar. As for the first one, can you attach a code snippet for how you initialize/setup that panel?

Could you clarify? It’s a static panel from Adobe as I understand. I do not initialize it in any way and I don’t think it comes with any of the plugins :thinking: It’s one of the first in panelList

Got it, the reason you’re seeing this is because brush settings is a panel that’s part of Photoshop – so it ends up with a positive ID.

For context, CEP and ExtendScript called these “static” because the ID would never change. For third-party plugin panels or ExtendScript dialogs, these were called “dynamic” because not every user would have them, or the order in which something was loaded might change, and so these were allocated negative IDs.

3P CEP panels are always listed under Window > Extensions (Legacy), whereas UXP 3P plugins are listed under Plugins menu… so the search process is a little different here. So the CEP panels will show up under PanelList but not in the menu.

Let me reach out to the Photoshop team to get you a clear answer on this!

2 Likes

Hi @Karmalakas,

I reached out to the Ps scripting team and can clarify two things:

  1. The panel with id: “panelid.static.options” is not a CEP panel. This id is used by the “options” bar.
  2. Because it’s not a panel, we currently don’t support 3rd parties to show arbitrary UI elements.

Since it’s not a panel, the menu command (being the current workaround for opening “panels”) won’t work.

1 Like

I see… Well, I guess I’ll have to ditch one feature I had in mind for the plugin :slight_smile: Thanks for the info