Quote:
You might want to take a look at the code I used in this snippet as it uses the chanfolder section of mIRC.ini
Thanks smile I had a look at it.
This snippet will work for many setups, but not for all:
- it does not take the general "enable autojoin" switch into account (a minor, and easily fixed)
- it does not take "minimize on join" into account (a minor too, but see next point)
- if "minimized" is ticked and "ajoin" unticked, it will mistake "minimized" for "ajoin" due to gettok(-1)
- fails if a "folder" is used (the folder will be added as last token)
- fails if set to "all networks" or multiple nets have been specified (the infamous "net1,net2,netx"-token)

I managed to get it work for all these cases, though I'm not happy with the beast of alias I have to call...
Code:
alias ajoin {
  ; if connected and "join on connect" is enabled for the favorites
  if ($status == connected) && ($gettok($readini($mircini,options,n4),37,44)) {
    var %net = $network, %n = 1

    ; loop favorites
    while ($ini($mircini,chanfolder,%n)) {
      var %r = $readini($mircini,chanfolder,$v1)

      /*
      the alias called below is ugly. but:
      1) you don't have 0-values but instead maybe consecutive commas
      2) the quoted "tokens" allow for commas inside them, e.g. multiple networks separated by comma
      examples:
      n01=#ChannelA,,,"Network",,,"Folder"
      n02=#ChannelB,"A channel description, with commas etc",SomePassword,"NetworkA,NetworkB",,1,"Mychans"
      n03=#ChannelC,,MyPass,,1,,"misc chans"
      n04=#ChannelD
      */

      ; chan=$1 "description"=$2 pass=$3 "network"=$4 autojoin=$5 join_minimized=$6 "group"=$7
      tokenize 11 $nullstring.token(44,$!null,%r)

      ; if this fav is either set for the current net or for no specific net 
      ; and if the fav has ajoin enabled, and I'm not already at this chan: join chan
      if (($4 == $!null) || ($istok($noqt($4),%net,44))) && ($5) && ($me !ison $1) { JOIN $iif($6,-n) $1 }

      inc %n
    }
  }
}



/*
$nullstring.token(<token-char>,<value to put for null-tokens>,<string>).[N of token]

For a <string> that is originally delimited by <token-char>, but may contain "quoted" tokens which may contain
the token-char itself, it returns the Nth token, or, if no N specified, the complete string separated by $chr(11).
All "null-tokens" of the <string> are filled with <value tu put for null-tokens>.

Using $chr(11) was a completely arbitrary choice. <string> may not contain any $chr(1).

Example:
var %text = ,,,x,"a value, with commas",,Y
"$nullstring.token(44,0,%text)" returns: "00x"a value, with commas"0Y"
"$nullstring.token(44,0,%text).4" returns: "a value, with commas"
"$nullstring.token(44,0,%text).5" returns: "0" (the value put for this null-token)
"$nullstring.token(44,0,%text).0" returns: "6" (the total number of tokens)
*/

alias nullstring.token {
  ; the token-separating char as ascii and octal; the value to put for null-tokens
  var %c = $iif($1 isnum,$v1,$asc($v1)), %co = $base(%c,10,8), %null = $2

  ; escape the token-separating char in "quoted tokens" by replacing this char with the "tempchar" $chr(1)
  var %t = $regsubex($$3-,/(".+?")(?=\ $+ %co $+ )/g,$replace(\t,$chr(%c),$chr(1)) )

  ; "fill null tokens": if the token-separating char is followed by itself, put the "fill"-value after the char
  var %t = $regsubex(%t,/\ $+ %co $+ (?=\ $+ %co $+ )/g,$chr(%c) $+ %null )

  ; if property N given: return the Nth token (backreplacing the tempchar)
  if ($prop isnum) { return $replace($gettok(%t,$v1,%c),$chr(1),$chr(%c)) }

  ; if no N property given: return complete <string> with it's tokens separated by $chr(11) (e.g. for later /tokenize)
  ; "switch chars": replace original token-separating char with $chr(11), switch tempchar $chr(1) back to char $1
  return $replacexcs(%t,$chr(%c),$chr(11),$chr(1),$chr(%c))
}

In case someone likes to use the code for a delayed join of his favorites: build a string of join commands instead of issuing the JOIN command, thereafter loop this string to fire timers for it's tokens. There are several examples for this kind of looping in the scripts of previous posts.