might be easier than you had thought to do this.
you dont really need to check windows as on start your not connected to any servers anyway. just server for the first read then server -m for all the others.
on *:start: {
var %a = 1
while (%a <= $lines(mircdirconnectionlist.txt)) {
if (%a == 1) { server $read(mircdirconnectionlist.txt,%a) }
else { server -m $read(mircdirconnectionlist.txt,%a) }
inc %x
}
}
but checking the number of lines every loop is kind of slow, even if its a small file. Best to save the number of lines into a variable then use that in the loops condition, or do it the fastest way with:
on *:start:{
.fopen serv mircdirconnectionlist.txt
server $fread(serv)
while (!$feof) {
server -m $fread(serv)
}
.fclose serv
}
As you see it justs uses /server the first read and then /server -m for all the others.