For button styles, add a custom property to the button, bind your criteria, and use custom styles to change the color. Don't don't do it with scripts. I have a global menu system for all main windows. Since only one main window can be viewed at a time, I use a client tag integer that holds the value of the current window, bind that to buttons to highlight based on window open.