mIRC Home    About    Download    Register    News    Help

Print Thread
infile search #204783 01/10/08 08:38 AM
Joined: Feb 2006
Posts: 97
O
ots654685 Offline OP
Babel fish
OP Offline
Babel fish
O
Joined: Feb 2006
Posts: 97
probably asked many times before but i'm unable to find any topic that fit my needs.

I'm trying to create a search script (prefering ini file) for multiple purpose.
That way i only need 1 file to make (instead of 6) and keeps it simple.

Only disadvantage using ini is that every item in topic needs different numbers.

[TOPIC]
ITEM01=data01
ITEM02=data02
ITEM03=data03
ITEM04=data04
ITEM05=data05

but searching ini is much more simple as in *.txt or *.dat.

alias search {
if (readini(ini,topic,word) == $1-) {
aline @search $1-
}
}

and for *.txt (found in other topic)

alias search2 {
var %find = $1-
var %ax = 0
var %file = $mircdirfile.dat
window -ak0SC @search 300 200 603 322
var %xlines = $lines(%file)
while (%ax <= %xlines) {
inc %ax
if (%find isin $read(%file,n,%ax)) { aline @search $read(%file,n,%ax) }
}
}

But in both situations i'm unable to search for just a piece of what the actual search was about.

/search Test gives everything with Test in it aka Test,Test2,Test3 etc.

But it won't work when i do this and only "Test" is in file.dat

/search This.is.a.test
or
/search This is a test

There is test in both but it gives me no results

Is there an easy way to fix this?

Re: infile search [Re: ots654685] #204784 01/10/08 09:01 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Searching a non-ini formatted file is simple.
That is at least part of the reason the $read identifier has the s, w, and r switches.
/help $read

As to searching an ini file, usage of a hash table or the /filter command look like your best bets.