If you want code to execute when a popup is loaded you can add an identifier to a menu item like:
menu menubar {
$didrun:noop
}
The above will execute $didrun everytime the menubar menu is rendered on screen.
As for simulating the event, you can perhaps simulate the menubar menu with COM, but you would need a DLL for the others, ironically. You can't do it with mIRC alone.