mIRC Home    About    Download    Register    News    Help

Print Thread
#25024 19/05/03 01:41 PM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
I would like to see the following extension to $readini
Example:

test.ini

[Test]
Polter*=Testing

now $readini(test.ini,Test,Poltergeist) will also return Testing
I know this will probably slow things down, but I think it would be a nice addition. I'm also working on a script around, but it's not working good enough yet. So if anyone knows???

#25025 19/05/03 01:44 PM
Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
and I think you should use hash tables


Code:
//if ( khaled isgod ) echo yes | else echo no
#25026 19/05/03 01:49 PM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
Could also do that yes, but I would like it to work on .INI files as well. Consider a very large .INI, you would still have to write everything in a hash file. I'm not asking how I can do it using other methods, I want to know if it CAN be done using .INI files

EDIT: damn typos :P

Last edited by Poltergeist; 19/05/03 01:49 PM.
#25027 19/05/03 01:59 PM
Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
well, mIRC uses windows' functions to write&read ini files? And I don't think windows supports wildcard matches in item names.
You could make your own functions for that but it would be slow as...


Code:
//if ( khaled isgod ) echo yes | else echo no
#25028 19/05/03 02:00 PM
Joined: Apr 2003
Posts: 26
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Apr 2003
Posts: 26
True, but a lot of mIRC IO functions use Windows API, but some of them are also extended, for example $read which also allows wildcard searches, so it could also be done to $readini right?

#25029 19/05/03 07:44 PM
Joined: Dec 2002
Posts: 39
L
Ameglian cow
Offline
Ameglian cow
L
Joined: Dec 2002
Posts: 39
I'd preffer to search a wildcard word, instead of storing wildcard characters on the file, ie:

[test]
blah=bleh
blahhhh=bloh

and search $readini(inifile, test, blah*) would return an iteration of matches, possibly parsed using $1-

#25030 22/05/03 04:00 AM
Joined: Mar 2003
Posts: 50
C
Babel fish
Offline
Babel fish
C
Joined: Mar 2003
Posts: 50
When reading this post I decided to create an identifer that would mimick the same behavior. Although it doesnt pass the results into a tokenized $1, $2 etc format, it does the same effect. If you want you can tokenize the results using a loop of sorts to achieve that. Here you go:

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 }
}

You would use the identifer in this way:

$wreadini(C:\my.ini,topic,search text,N,format)
N of course returns the Nth matching ini item. if N is 0 it returns total items found. Wildcard characters can be accepted in the search text. The format parameter can be used to return the results in a specific way such as:

0 = returns the value
1 = returns item=value
2 = returns item
3+ = returns value

Enjoy smile


Link Copied to Clipboard