Yeah there is /scon command which makes active the connection you want and $scon . These might be helpfull.
Examples: /scon 1 makes the 1st connection active
/scon 2 makes the 2nd connection active and so on. whatever command you put after the /scon will be done only by the connection you activated.
$scon(1).network returns the network name of the 1st connection
$scon(1).server returns the server which you are using on the network of the 1st connection
$scon(1).me returns the user's nick on the 1st connection
You can actually use any identifier that is related to a connection as .parameter but not the ones that have brackets.
For example if you do //echo -at $scon(1).address($me,2) will return the followinng: * $scon: property cannot use brackets
I hope these help, for more help check the help files and this wiki maybe http://en.wikichip.org/wiki/mirc/identifiers/$sconhttp://en.wikichip.org/wiki//scon
P.S Although you could use 2 different mIRC's for easier scripting but it's up to you. In any case you go with /scon is good to know for other situations too