# Enable/disable menu or button based on filetype

**URL:** <https://resource.dopus.com/t/enable-disable-menu-or-button-based-on-filetype/23403>\
**Category:** Help & Support\
**Created:** [September 10, 2016, 1:15pm UTC](https://resource.dopus.com/t/enable-disable-menu-or-button-based-on-filetype/23403 "2016-09-10T13:15:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amorax](https://resource.dopus.com/user_avatar/resource.dopus.com/amorax/32/37796_2.png) [@Amorax](https://resource.dopus.com/u/Amorax)\
**Post date:** [September 10, 2016, 1:15pm UTC](https://resource.dopus.com/t/enable-disable-menu-or-button-based-on-filetype/23403/1 "2016-09-10T13:15:31Z")

</div>

Is it possible to enable/disable a menu (or button) based on the filetype of the selected file or based on a specific group of files (e.g. images)?  
Just like the Image toolbar appears/disappears when entering a folder with images I want a menu to enable/disable.

'm not very happy with the Image toolbar so I want to place those buttons in a menu.  
The button that works well with all files is the Show button. Also some sort buttons work fine. Other buttons do nothing when I have selected a file other than an image so at least no error messages. But it would be nice if I could disable the menu and/or buttons when they are not applicable. Is this possible in DO12?

---

<div class="post-metadata">

**Author:** ![Jon](https://resource.dopus.com/user_avatar/resource.dopus.com/jon/32/12713_2.png) [@Jon](https://resource.dopus.com/u/Jon)\
**Post date:** [September 10, 2016, 1:22pm UTC](https://resource.dopus.com/t/enable-disable-menu-or-button-based-on-filetype/23403/2 "2016-09-10T13:22:54Z")

</div>

Yes, using the @hidenosel and @disablenosel command modifiers, described [here](http://www.gpsoft.com.au/help/opus12/index.html#!Documents/Command_modifier_reference.htm).

---

<div class="post-metadata">

**Author:** ![Amorax](https://resource.dopus.com/user_avatar/resource.dopus.com/amorax/32/37796_2.png) [@Amorax](https://resource.dopus.com/u/Amorax)\
**Post date:** [September 10, 2016, 1:28pm UTC](https://resource.dopus.com/t/enable-disable-menu-or-button-based-on-filetype/23403/3 "2016-09-10T13:28:06Z")

</div>

Great. Thanks for the quick reponse.

---

<div class="post-metadata">

**Author:** ![Amorax](https://resource.dopus.com/user_avatar/resource.dopus.com/amorax/32/37796_2.png) [@Amorax](https://resource.dopus.com/u/Amorax)\
**Post date:** [September 10, 2016, 2:03pm UTC](https://resource.dopus.com/t/enable-disable-menu-or-button-based-on-filetype/23403/4 "2016-09-10T14:03:31Z")

</div>

I don't get it working.  
When I add @disablenosel:type=\*.jpg to the Rotate Left button it stays always enabled. Only when no file is selected the button is disabled but that's a build in function because I see no option in the button function, which is:

`Image ROTATE=270 HERE REPLACE
@disablenosel:type=*.jpg
@nodeselect`

Also, do I have to enter all image filetypes or is there a category for all image files?

If I heve to enter all image files (or at least the main ones) can I use a separator or do I need to repeat the @disablenosel line for every filetype? I tried to test this but because the disabling is not working at all I didn't get far.

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [September 10, 2016, 3:25pm UTC](https://resource.dopus.com/t/enable-disable-menu-or-button-based-on-filetype/23403/5 "2016-09-10T15:25:50Z")

</div>

Put the @disablenosel line at the top, or at least before the Image command.

You can use grp:Images to make everything in the Images file type group:

`@disablenosel:type=grp:Images
@nodeselect
Image ROTATE=270 HERE REPLACE`

---

<div class="post-metadata">

**Author:** ![Amorax](https://resource.dopus.com/user_avatar/resource.dopus.com/amorax/32/37796_2.png) [@Amorax](https://resource.dopus.com/u/Amorax)\
**Post date:** [September 10, 2016, 3:34pm UTC](https://resource.dopus.com/t/enable-disable-menu-or-button-based-on-filetype/23403/6 "2016-09-10T15:34:42Z")

</div>

Ah, the order matters. Now it's working the way I want. And the grp type is also very handy. Thanks again. 👍
