The Framework manager has a new method avChangeCommandState, that allows commands to be programmatically enabled or disabled.
Refer to and execute the Advanced -> Command Enablement example in the Advanced examples DF_T63H1O for more information:
Also, see Change Command State Programmatically.

