Yes, it's possible to do this in mIRC scripting.
You can type the following commands into mIRC (where you'd normally type):
/help on input
/help $chan(N/#)
/help $chan
/help $nick($nick(#,N/nick,aohvr,aohvr)
/help If Then Else
/help Variables
That should have about everything you'd need to know to do what you want to do. I'd guess you'd be checking if $nick($chan,0,v) (only voices) is greater than zero (means there are that number of voices in the channel). Also, you use ALT + R (two times) to get into the remote section, where the "on input" event would be.