# Opening/Closing the Libraries window without using CommandID

**URL:** <https://forums.creativeclouddeveloper.com/t/opening-closing-the-libraries-window-without-using-commandid/5532>\
**Category:** UXP Plugin API\
**Created:** [November 28, 2022, 10:42pm UTC](https://forums.creativeclouddeveloper.com/t/opening-closing-the-libraries-window-without-using-commandid/5532 "2022-11-28T22:42:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trasatti](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Trasatti](https://forums.creativeclouddeveloper.com/u/Trasatti)\
**Post date:** [November 28, 2022, 10:42pm UTC](https://forums.creativeclouddeveloper.com/t/opening-closing-the-libraries-window-without-using-commandid/5532/1 "2022-11-28T22:42:44Z")

</div>

The commandID that Alchemist listener returns when opening the Libraries window is a negative number

The thing that is very strange for me is that Alchemist listener returns for the same command (open the Libraries window) a different command ID, always negative, based on how many and which Plugins are installed in the system. The command ID returned by Batchpaly is therefore unusable

It’s a strange thing, it only happens for the Libraries window, it doesn’t happen for the other windows, such as Swatch and others, where Alchemist listener always returns the same command ID, positive, which I can use correctly in my code

I would like to know how I could open/close the Library window, without using the commandID  
but, for example, using the “panelList” property

Thanks

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [November 29, 2022, 9:17am UTC](https://forums.creativeclouddeveloper.com/t/opening-closing-the-libraries-window-without-using-commandid/5532/2 "2022-11-29T09:17:21Z")

</div>

I think you’ll need to find your item in the menu bar by name or ID and then use the command. You can get menu bar tree with a script like in this post:

> [@How to get Photoshop menu item checked status?](http://forums.creativeclouddeveloper.com/t/how-to-get-photoshop-menu-item-checked-status/5319/2):
>
> If you find your menu item in menuBarInfo, you will se a checked param [image] const photoshop = require("photoshop"); const getMenuItem = () =\> { return photoshop.action.batchPlay([{ "\_obj": "get", "\_target": [{"\_property": "menuBarInfo"}, {"\_ref": "application", "\_enum": "ordinal", "\_value": "targetEnum"},], "\_options": {"dialogOptions": "dontDisplay"} }], {synchronousExecution: true})[0]["menuBarInfo"]["submenu"] }…

---

<div class="post-metadata">

**Author:** ![Trasatti](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Trasatti](https://forums.creativeclouddeveloper.com/u/Trasatti)\
**Post date:** [November 29, 2022, 10:13am UTC](https://forums.creativeclouddeveloper.com/t/opening-closing-the-libraries-window-without-using-commandid/5532/3 "2022-11-29T10:13:50Z")

</div>

Thanks @Karmalakas

I see, in the post you’re referring to, a way to READ the state of the submenu item, my request instead concerns how to SET the state of the submenu , and WITHOUT USING the command ID for the reasons I explained in my post. I use capital letters here in an attempt to better clarify my requirement - thank you

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [November 29, 2022, 10:23am UTC](https://forums.creativeclouddeveloper.com/t/opening-closing-the-libraries-window-without-using-commandid/5532/4 "2022-11-29T10:23:27Z")

</div>

Sorry, I don’t know how to do it without the command ID. What I’m suggesting, is - before running a command, you would find the menu item you want (by ID for example) and use the assigned command. At least that’s what I do in my plugin. If someone knows a better way, would be glad to see it and maybe apply it myself.

---

<div class="post-metadata">

**Author:** ![Trasatti](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Trasatti](https://forums.creativeclouddeveloper.com/u/Trasatti)\
**Post date:** [November 29, 2022, 12:49pm UTC](https://forums.creativeclouddeveloper.com/t/opening-closing-the-libraries-window-without-using-commandid/5532/5 "2022-11-29T12:49:24Z")

</div>

Yes, hopefully someone can tell us how to make a Libraries window submenu visible / invisible without using commandID. I’d also be curious if anyone is able to view/hide Libraries using the commandID without problems (as for other submenu - see my initial post)
