<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://script.quakenet.org/wiki/index.php?action=history&amp;feed=atom&amp;title=%24mIni_ini_searching_alias</id>
	<title>$mIni ini searching alias - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://script.quakenet.org/wiki/index.php?action=history&amp;feed=atom&amp;title=%24mIni_ini_searching_alias"/>
	<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$mIni_ini_searching_alias&amp;action=history"/>
	<updated>2026-06-04T00:40:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$mIni_ini_searching_alias&amp;diff=4581&amp;oldid=prev</id>
		<title>Cail: added category</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$mIni_ini_searching_alias&amp;diff=4581&amp;oldid=prev"/>
		<updated>2006-11-02T18:27:05Z</updated>

		<summary type="html">&lt;p&gt;added category&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:27, 2 November 2006&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l152&quot;&gt;Line 152:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 152:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   return %result&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   return %result&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Script Archive]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Cail</name></author>
	</entry>
	<entry>
		<id>https://script.quakenet.org/wiki/index.php?title=$mIni_ini_searching_alias&amp;diff=1677&amp;oldid=prev</id>
		<title>Cail: added $mIni alias</title>
		<link rel="alternate" type="text/html" href="https://script.quakenet.org/wiki/index.php?title=$mIni_ini_searching_alias&amp;diff=1677&amp;oldid=prev"/>
		<updated>2006-11-02T18:24:06Z</updated>

		<summary type="html">&lt;p&gt;added $mIni alias&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;$mIni([folder/][,file][,file2..,fileN],[topic][,topic2..,topicN],searchstring,[N])&amp;#039;&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
Properties: .data .file .topic&amp;lt;br /&amp;gt;&lt;br /&gt;
Attach properties with + ie. $mIni().data+file+topic will use all of the properties&amp;lt;br /&amp;gt;&lt;br /&gt;
.data = search for data from item=data&amp;lt;br /&amp;gt;&lt;br /&gt;
.file = include &amp;lt;filename&amp;gt; into the result&amp;lt;br /&amp;gt;&lt;br /&gt;
.topic = include [topic] into the result&lt;br /&gt;
&lt;br /&gt;
.file and .topic are mostly for debugging, but can also be used to find out what file has the searchstring&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All parameters except the searchsting are optional, if you don&amp;#039;t specify folder/file $mircdir is used&lt;br /&gt;
if you specify folder, all of ini files in the folder will be searched&lt;br /&gt;
you can also specify many files ie. $mIni(one.ini two.ini three.ini,topics,searchstring) or $mIni(folder/one.ini two.ini three.ini,topics,searchstring)&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t specify topic(s), all the sections of the files are searched, seperate different topics with space&lt;br /&gt;
&lt;br /&gt;
Searchstring is a plaintext search, no wildcards (might change that in the future)&lt;br /&gt;
&lt;br /&gt;
N is also optional, if not given, returns all of the matches in form of &amp;quot;item=data item2=data2&amp;quot;&lt;br /&gt;
0 returns number of mathces, a number above 0 returns Nth match&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Examples:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
 lets say i have a folder /ini/ in my mircdir, where there are 3 ini files one.ini, two.ini and three.ini with various sections and items&lt;br /&gt;
 $mIni(ini/one.ini two.ini,,test) returns test=abc test=def test=ghi&lt;br /&gt;
 $mIni(ini/one.ini two.ini,,test).file+topic returns: &amp;lt;one.ini&amp;gt;[topic_1]test=abc &amp;lt;one.ini&amp;gt;[topic_2]test=def &amp;lt;two.ini&amp;gt;[some_topic]test=ghi&lt;br /&gt;
 $mIni(ini/one.ini two.ini,,test,0) returns: 3&lt;br /&gt;
 $mIni(ini,,test).file+topic returns: &amp;lt;one.ini&amp;gt;[topic_1]test=abc &amp;lt;one.ini&amp;gt;[topic_2]test=def &amp;lt;two.ini&amp;gt;[some_topic]test=ghi &amp;lt;three.ini&amp;gt;[another_topic]test=jkl&lt;br /&gt;
 $mIni(,,main).file+topic searches all files from $mircdir and every topic, eventually returns: &amp;lt;mirc.ini&amp;gt;[windows]main=0,1196,166,745,3,1,0&lt;br /&gt;
 note that $mIni(,,main,1) will be a lot faster than $mIni(,,main) since the script stops searching after the 1st match&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$mIni&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 alias mIni {&lt;br /&gt;
  ;replace \ with / so we can match / later.&lt;br /&gt;
  var %s = $replace($1,\,/)&lt;br /&gt;
 &lt;br /&gt;
  ;take folder out of the string and take the full path ie. &amp;quot;ini/file.ini&amp;quot; -&amp;gt; &amp;quot;C:/program files/mIRC/ini/&amp;quot;&lt;br /&gt;
  ;if no folder found, use $mircdir&lt;br /&gt;
  var %dir = $+($iif($isdir(%s),$longfn(%s),$iif(/ isin %s,$longfn($gettok(%s,1- $calc($numtok(%s,47) -1),47)),$left($mircdir,-1))),\)&lt;br /&gt;
 &lt;br /&gt;
  ;get the files (will take the directory if no files are specified, but we&amp;#039;ll strip it out)&lt;br /&gt;
  var %files = $gettok(%s,-1,47)&lt;br /&gt;
 &lt;br /&gt;
  ;set topics which we need to search for into a variable&lt;br /&gt;
  var %topics = $2&lt;br /&gt;
 &lt;br /&gt;
  ;set the searchstring into a variable and make variables %result to store the return value, and %tinc which will be increased if N is &amp;gt;0&lt;br /&gt;
  var %find = $3&lt;br /&gt;
  var %result,%tinc = 0&lt;br /&gt;
 &lt;br /&gt;
  ;get the properties and set the value of variables $true if certain properties are given, ie $mIni().data+file+topic&lt;br /&gt;
  if ($istok($prop,data,43)) { var %prop_data = $true }&lt;br /&gt;
  if ($istok($prop,file,43)) { var %prop_file = $true }&lt;br /&gt;
  if ($istok($prop,topic,43)) { var %prop_topic = $true }&lt;br /&gt;
 &lt;br /&gt;
  ;this loop goes through all of the files in %files variable and checks if they exsis and they end in .ini, removes if they doesn&amp;#039;t&lt;br /&gt;
  var %x = 1 &lt;br /&gt;
  while (%x &amp;lt;= $numtok(%files,32)) { &lt;br /&gt;
    if ($right($gettok(%files,%x,32),4) != .ini) || (!$exists($+(%dir,$gettok(%files,%x,32)))) { &lt;br /&gt;
      var %files = $deltok(%files,%x,32) &lt;br /&gt;
    }&lt;br /&gt;
    inc %x&lt;br /&gt;
  }&lt;br /&gt;
 &lt;br /&gt;
  ;if %files is empty (no files given, or files given didn&amp;#039;t exist and were stripped), find all ini files from %dir&lt;br /&gt;
  if (!%files) { noop $findfile(%dir,*.ini,0,1, var %files = %files $nopath($1-)) }&lt;br /&gt;
 &lt;br /&gt;
  ;a loop to go through the files in %files variable&lt;br /&gt;
  var %x = 1&lt;br /&gt;
  while (%x &amp;lt;= $numtok(%files,32)) {&lt;br /&gt;
 &lt;br /&gt;
    ;%dirfile is the filename, including the directory, and %file is only the filename, for output&lt;br /&gt;
    var %dirfile = $+(%dir,$gettok(%files,%x,32))&lt;br /&gt;
    var %file = $gettok(%files,%x,32)&lt;br /&gt;
 &lt;br /&gt;
    ;we need to unset %topics2, so it won&amp;#039;t be filled already next time this loop runs&lt;br /&gt;
    unset %topics2&lt;br /&gt;
 &lt;br /&gt;
    ;if the user doesn&amp;#039;t give a topic to search, find all topics from the file&lt;br /&gt;
    if (%topics == $null) { &lt;br /&gt;
      var %xy = 1&lt;br /&gt;
      while (%xy &amp;lt;= $ini(%dirfile,0)) {&lt;br /&gt;
        var %topics2 = %topics2 $ini(%dirfile,%xy)&lt;br /&gt;
        inc %xy&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    ;else we use the topics user has given&lt;br /&gt;
    else { var %topics2 = %topics }&lt;br /&gt;
 &lt;br /&gt;
    ;a loop to go through the given topics from a file&lt;br /&gt;
    var %y = 1&lt;br /&gt;
    while (%y &amp;lt;= $numtok(%topics2,32)) { &lt;br /&gt;
 &lt;br /&gt;
      ;set %topic (for readability purposes), and loop through all the items in %topic that is in %file&lt;br /&gt;
      var %topic = $gettok(%topics2,%y,32)&lt;br /&gt;
      var %z = 1&lt;br /&gt;
      while (%z &amp;lt;= $ini(%dirfile,%topic,0)) {&lt;br /&gt;
 &lt;br /&gt;
        ;check if the user is searching for an item, not a data value, and matching item found&lt;br /&gt;
        if ((!%prop_data) &amp;amp;&amp;amp; ($ini(%dirfile,%topic,%z) == %find)) { &lt;br /&gt;
 &lt;br /&gt;
          ;if $4 is null or not given, get all of the item=data into the same string&lt;br /&gt;
          ;also if %prop_file is $true, add &amp;lt;%file&amp;gt; in front of the item=data&lt;br /&gt;
          ;same for %prop_topic to include [%topic] &lt;br /&gt;
          if ($4 == $null) { &lt;br /&gt;
            var %result = %result $+($iif(%prop_file,$+(&amp;lt;,%file,&amp;gt;),),$iif(%prop_topic,$+($chr(91),%topic,$chr(93)),),$ini(%dirfile,%topic,%z),=,$readini(%dirfile,n,%topic,$ini(%dirfile,%topic,%z)))  &lt;br /&gt;
          }&lt;br /&gt;
 &lt;br /&gt;
          ;if $4 is 0, increment the %result, so that number of the matches can be returned&lt;br /&gt;
          elseif ($4 == 0) { inc %result } &lt;br /&gt;
 &lt;br /&gt;
          ;if $4 is a number &amp;gt;0, increment %tinc and check if its value is the same as $4, return the match&lt;br /&gt;
          ;also checks for .file and .topic properties&lt;br /&gt;
          elseif ($4 isnum 1-) { &lt;br /&gt;
            inc %tinc &lt;br /&gt;
            if (%tinc == $4) { &lt;br /&gt;
              %result =  $+($iif(%prop_file,$+(&amp;lt;,%file,&amp;gt;),),$iif(%prop_topic,$+($chr(91),%topic,$chr(93)),),$readini(%dirfile,n,%topic,$ini(%dirfile,%topic,%z)))&lt;br /&gt;
              return %result&lt;br /&gt;
            }&lt;br /&gt;
          }       &lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
        ;else if the user is looking for data and matching data found&lt;br /&gt;
        elseif ((%prop_data) &amp;amp;&amp;amp; ($readini(%dirfile,n,%topic,$ini(%dirfile,%topic,%z)) == %find))  {&lt;br /&gt;
 &lt;br /&gt;
          ;if $4 is null or not given, get all of the item=data into same string&lt;br /&gt;
          ;also if %prop_file is $true, add &amp;lt;%file&amp;gt; in front of the item=data&lt;br /&gt;
          ;same for %prop_topic to include [%topic] &lt;br /&gt;
          if ($4 == $null) { &lt;br /&gt;
            var %result = %result $+($iif(%prop_file,$+(&amp;lt;,%file,&amp;gt;),),$iif(%prop_topic,$+($chr(91),%topic,$chr(93)),),$ini(%dirfile,%topic,%z),=,$readini(%dirfile,n,%topic,$ini(%dirfile,%topic,%z)))  &lt;br /&gt;
          }&lt;br /&gt;
 &lt;br /&gt;
          ;if $4 is 0, increment the %result, so that number of the matches can be returned&lt;br /&gt;
          elseif ($4 == 0) { inc %result }  &lt;br /&gt;
  &lt;br /&gt;
          ;if $4 is a number &amp;gt;0, increment %tinc and check if its value is the same as $4, return the match&lt;br /&gt;
          ;also checks for .file and .topic properties&lt;br /&gt;
          elseif ($4 isnum 1-) { &lt;br /&gt;
            inc %tinc &lt;br /&gt;
            if (%tinc == $4) { &lt;br /&gt;
              %result = $+($iif(%prop_file,$+(&amp;lt;,%file,&amp;gt;),),$iif(%prop_topic,$+($chr(91),%topic,$chr(93)),),$ini(%dirfile,%topic,%z))&lt;br /&gt;
              return %result&lt;br /&gt;
            }&lt;br /&gt;
          }       &lt;br /&gt;
        }&lt;br /&gt;
        inc %z&lt;br /&gt;
      }&lt;br /&gt;
      inc %y &lt;br /&gt;
    } &lt;br /&gt;
    inc %x&lt;br /&gt;
  }&lt;br /&gt;
  return %result&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Cail</name></author>
	</entry>
</feed>