Conditionally add/remove Commands?

Since Commands belong both to the manifest.json (the structure) and JavaScript as well (the implementation) I doubt it could be done, but I’m asking anyway: is it possible to conditionally display them?
E.g. I’d like to have, say, a command menu item for Windows and not for Mac. I can change the command click handler depending on the platform (or whatever check I need to perform), but what about the menu item itself: can it be added/removed/edited?
Thanks!

Davide

1 Like

Sadly, at least not yet

1 Like

While you can’t conditionally control commands that show in the Plugins menu, you can control those for the flyout menu (specified during entrypoints.setup).

Not ideal, but maybe an option.

What’s the menu item(s) you’d like to be able to control here, though? Is it OS-specific terminology that you’re trying to control for?

I was thinking something about additional modules/scripts inside plugin. Or perhaps “lite” vs “premium” versions of plugin. Both within same plugin but it would conditionally unlock more features based on license. Or perhaps contextual menu based on document state or stage within your plugin. There are so many options…

2 Likes

That’s a good idea. Trial and full versions are maybe a second argument here.

You’ve guess it right Kerri :grin:
It’s not a crucial feature, just a cosmetic thing (I’d need to hide a command if the user is on M1)