There is an event that keeps checking if type Model?

There is an event that keeps checking if the active file is a part, drawing or assembly. ?

Currently I have a loop but, but some commands are not active, such as when I click on a component the command edit part is not active, among others. As the hotkey "S" both gives and does not.

If anyone can help, I would appreciate it.

Thank.

SolidworksApi/macros