As you cannot create "nested submenus", it's a bit long winded... You'd have to build some initial "list" in the submenu begin event, and return the items of that list in the main submenu procedure.
In the following example, I used global vars "%invite.item.<N>" for the "list" (unsetting right after the submenu has finished).
menu channel,status {
invite me to...
.$submenu($testinvite.submenu($1))
}
alias -l testinvite.submenu {
if ($1 == begin) {
; set your inifile
var %inifile = $scriptdir $+ settings.ini
var %netN = 1, %count = 1
; loop the networks = items of ini
while ($ini(%inifile,invite,%netN)) {
var %net = $v1, %chanN = 1
; put a line to the list containing the network to be some kind of "header"
set -u $+(%,invite.item.,%count) --- network %net --- : noop
inc %count
; loop the channels of that network = data of ini
while ($gettok($readini(%inifile,invite,%net),%chanN,44)) {
; put a line to the list including the invite command this chan
set -u $+(%,invite.item.,%count) chan $v1 : invite.me $v1
inc %chanN
inc %count
}
inc %netN
}
}
; return the list of items
elseif ($($+(%,invite.item.,$1),2)) { return $v1 }
}
...that's the basic idea.
But note that - for the moment - mIRC will NOT know which server connection is associated with this or that net, and will perform the invite command at the CURRENT connection. you may send the network name "%net" as a second parameter to your invite.me alias and perform a loop of scons there...
...or (and I'd prefer it): you could show ONLY channels set for the current network in the invite submenu. This will look like:
menu channel,status {
invite me to...
.$submenu($testinvite.submenu2($1))
}
alias -l testinvite.submenu2 {
if (($1 isnum) && ($gettok($readini($scriptdir $+ settings.ini,invite,$network),$1,44))) {
return $v1 : invite.me $v1
}
}