You can simply do:
alias amsgx var %msg = $1- | scon -at1 amsg % $+ msg
alias amex var %msg = $1- | scon -at1 ame % $+ msg
It\'s really a bad idea to name your aliases the same as the built-in aliases, because now when someone does an /ame, it will do it on all server windows.
The reason that I use a variable and escape it in the code like that, is because there is danger of dubble evaluation when using the scon/scid commands. This is illustrated when doing: //scon -a echo -a $!me
Additionally, you are not checking $status on each server, which will result into an error when you try to describe or message a channel on an offline server window.
Also, as I stated in another comment section, $chan() doesn\'t make a distinction between channels that you are in, and those that were left open after a disconnect (channels you are no longer in, in other words), so you should loop with $comchan($me,%x)
But anyway, like said, looping isn\'t needed at all.
Btw if you decided to recreate the aliases to use scon -at1 ame/amsg, then you MUST escape the ame/amsg commands by prefixing them with a ! or it would close your mIRC because of infinite recursion.
Example:
alias amsg var %msg = $1- | scon -at1 !amsg % $+ msg
alias ame var %msg = $1- | scon -at1 !ame % $+ msg