Events trigger with the status window as the active window, so it's likely that $active has the value "status window", breaking the number of parameter passed to /window.
The workaround is to use a timer if I recall correctly.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel