mIRC Home    About    Download    Register    News    Help

Print Thread
$readini suggestion #26947 29/05/03 05:39 PM
Joined: Mar 2003
Posts: 58
A
Adler Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Mar 2003
Posts: 58
$readini(filename, [n], section, item)
Returns a single line of text from an ini file

if an item has more than one word
$readini(filename, [n], section, item, $1 )

I know i could use $gettok, but i think its more comfortabler and make the scripts faster

Re: $readini suggestion #26948 30/05/03 01:13 AM
Joined: Mar 2003
Posts: 50
C
coolspot Offline
Babel fish
Offline
Babel fish
C
Joined: Mar 2003
Posts: 50
That would be somewhat useful however Im not sure I completely 100% follow... do you mean item as in:

This is my item=it has multiple words

If $readini could read that? I have something I scripting that may help you however its not for item having multiple word. Im not all to sure, but I believe the standard INI format is for single word items. Otherwise I dont think it would be considered an INI.

Re: $readini suggestion #26949 30/05/03 06:15 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I don't believe that ini's can have a space for a variable name, can they?


-KingTomato
Re: $readini suggestion #26950 30/05/03 08:28 AM
Joined: Mar 2003
Posts: 58
A
Adler Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Mar 2003
Posts: 58
yes, but its a suggestion...

If i have 3 Items for 1 function, i must be write 3 lines or use gettok.
I think its useful.....

[EDIT]
So is it correct, sorry...
$readini(filename, [n], section, item, 1 )

Last edited by Adler; 30/05/03 08:40 AM.
Re: $readini suggestion #26951 30/05/03 06:07 PM
Joined: Mar 2003
Posts: 50
C
coolspot Offline
Babel fish
Offline
Babel fish
C
Joined: Mar 2003
Posts: 50
I'm not sure if this will help you or not, but this may make your data handling a little easier with INI items, its $readini but with wildcard search compatibility:

; Usage:
; $wreadini(filename, topic, text-pattern, N, format)
;
; the text-pattern parameter can contain wildcard
; characters such as * and ?. As well the N
; parameter can be either 0 or above.
;
; if N is 0 it will return the total matches
;
; Heres an example:
;
; $wreadini(c:\test.ini,mirc,w?il?ca*,1,3)
;
; since N is 1 this would return the 1st matching
; item. w?il?ca* could be any of the following
; matches:
;
; wildcard
; wildcardddddd
; wailscabeww
;
; the format parameter can be one of 3 options:
;
; * can be used alone for the search pattern to return
; all items within a specific section in the ini file.
;
; 0 - value
; 1 - item=value
; 2 - item
; 3+ - value
;
; format can be null and will default to format 3
; Enjoy!

alias wreadini {
var %f = $iif($chr(32) isin $1,$+(",$1,"),$1), %l = 1, %r = 0, %p
if (($0 < 4) || (!$isfile(%f))) { echo $color(info) -q * Invalid parameters: $eval($wreadini,0) | return }
while ($ini(%f,$2,%l)) {
var %x = $ini(%f,$2,%l)
if ($eval($3,2) iswm %x) {
%p = $readini(%f,n,$2,%x)
inc %r
if (($4 != 0) && (%r = $4)) {
if ($5) {
if ($5 = 1) { return $+(%x,=,%p) }
elseif ($5 = 2) { return %x }
else { return %p }
}
else { return %p }
}
}
inc %l
}
if ($4 = 0) { return %r }
}

Hope this helps you in some way... maybe you can modify it to extend its functionality for what your needing smile