Can I run a common event when opening the main menu?

Im using Yanfly's MainMenuManager to recreate the menu buttons so each page has its own window color, so I replaced the default "Item" button with my own version of it which changes the window color and then open the item screen. However, this means that when you pause again the window color will be set to the same one of the menu you acessed last time, I tried using Yanfly's UtilityCommonEvents to set run a common event when you close the menu, but since I am not usuing the default menu button, closing a menu unpause the game instead of taking you back to the main menu, so that didnt worked. So I was hoping there was a way for me to run a common event upon opening the main menu
This explanation is confusing.
as said your description is confusing - but I don't need to understand what you're trying to do to answer the question:

no

there is a game-interpreter on the map, and another one on the battlescreen. Those are needed to process any event, and no other screen has them included.
So no, none of the screens can run a common event by default.

your two options are only:
1) replace the menues completely by disabling access to them and have a common event create your entire menu
That is a lot of work
2) use a plugin that installs additional interpreters on the other screens to enable using common events on them
This can become a configuration nightmare, especially if mixing in other menu-manipulating plugins

so there is no simple solution, but it can be done.
Are you talking about this:
Eventcommand disable menu access, execute at game start.
Than parallel common event which also gets activated at game start.
Code for CE:
If Menu Button is pressed? if yes: do your stuff, like calling a common event, turning switch X on and than opening standard menu with event or script command. While menu is open the common event will not run but we turned the switch on directly before we opened it.
That means when we close the menu, that switch helps us knowing that the menu was open, so we can use it in a if statement and let something happen again.
But a common Event cant run while a Menu Screen is Open, like Andar explained.
But this is just a Guess, maybe it helps.
This explanation is confusing.
Yeah thanks, this helps a lot. I can totally try to give you a better explanation when you don't say what you couldnt understand. But its okay, I was already able to solve this problem, I just forgot to update this thread
Would you mind telling us the solution, it could be very interesting.
And I should have avoided to make such Post. No hard feelings, i was just short on time and it somehow happened, my apologies.
Yeah I apologise too, I was having a rough and busy week, hence why I took so long to reply. My solution was kinda similar to what you proposed, but simplier (since I could understand the problem): When you open a submenu (items menu, equip menu, etc) it does its thing and set a switch on, and Ive also made a common event that runs when that switch is on, doing its thing and turning it off.

When that switch is set to "on" you are at the main menu, so the common event tied to it will only run when you exit it

Original thread: https://forums.rpgmakerweb.com/threads/can-i-run-a-common-event-when-opening-the-main-menu.111033/