okay, this:
$replace($chan(#chan1) $chan(#chan2),$chr(32),$chr(44))
will output list of active channels separated by comma, ready for the /msg command.
your command can then be:
/scon -at1 if (
$replace($chan(#chan1) $chan(#chan2),$chr(32),$chr(44))) msg $ifmatch <message>
I hope it's clear enough, anyway.