You can simulate a keystroke using COM objects, but you'll have to open up the mIRC menus to do that, so on slow computers there might be a slight flicker. Seems fine on mine though.
Code:
alias sendkeys {
var %object = sendkeys $+ $ticks
.comopen %object WScript.Shell
if ($com(%object)) { .comclose %object $com(%object,SendKeys,3,bstr,$1-) }
}
alias toggletreebar { sendkeys % $+ vr }
alias toggletoolbar { sendkeys % $+ vt }