AnsweredAssumed Answered

Add-ins: Make a command available only for select file types?

Question asked by Steven Soeder on Aug 13, 2015
Latest reply on Aug 14, 2015 by Jeff Sweeney

Using AddCmd is there any way to specify that a menu command or toolbar button should only be accessible for files of a certain type?
E.g. if I only want a menu command to be available for Solidworks drawings, but not part or assembly files?  Or only for word files, or only access files, etc.


I don't see anything in the EdmFlags to allow for this, but maybe there is some other way?


Currently I have a select case in my executing routine which tells the user the command is not valid for the selected file-type if they try to run it with the wrong type of file selected, however this is rather clunky and results in a rather poor user experience.


It would be much better if I could either not show the command, or even grey it out, for files that do not match the type I want.



I thought it worth mentioning that I've been toying with the idea of creating a command button on the file card for the desired extensions, I think this would achieve the end result of a command only being available for the correct file types.

The only thing stopping me from doing this now is that we use different file cards for the same file types in different folders of the vault, so this might be more work than it's worth.  I figured before spending too much time on it, I'd post here and see if there was any other (possibly better) way