If you want to check all channels that you are in on a certain network, you can loop through $comchan.

/help $comchan

I say $comchan and not $chan, as $chan doesn't make a distinction between open channels, and channel windows that you haven't rejoined after a reconnect.

I don't know if you know how to do loops in mIRC but it would be something like this:

var %i = 1
while ($comchan($me,%i)) {
echo -a Chan %i - $ifmatch
inc %i
}

or

var %i = 1, %ii = $comchan($me,0)
while (%i <= %ii) {
echo -a Chan %i - $comchan($me,%i)
inc %i
}

var %i = $comchan($me,0)
while (%i) {
echo -a $comchan($me,%i)
dec %i
}

etc. there are a couple more variations possible but you get the picture.

You could also check with $dde, but that has some drawbacks, that make it not worth using it.