mIRC Home    About    Download    Register    News    Help

Print Thread
#206007 05/11/08 08:07 PM
Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Hello,

I have a quick question for the pros here.

I have an ini file that is structured like this:

(Name of the file: "C:\mIRC\UserInfo.ini")

[UserInfo]
Nickname1=*!5f67d56b2beb4a8b8ff3433eea054532@*,123.123.123.123
Nickname2=*!ba61856984f923042acb2b540b6c787c@*,124.124.124.124
Nickname3=*!261aa8fae20cc56feb47907091edfa13@*,125.125.125.125



Example #1 (Searching by a Nickname)

I would like to have an alias like $search_ini(nickname1) that would echo me: Nickname1's address is: *!5f67d56b2beb4a8b8ff3433eea054532@* and their ip address is: 123.123.123.123.

Example #2 (Searching by a single value)

a.)
I would like to then have the alias $search_ini(123.123.123.123) would echo to me: The IP Address: 123.123.123.123 belongs to Nickname1.

b)
Same goes for $search_ini(*!5f67d56b2beb4a8b8ff3433eea054532@*) would echo back to me: The address: *!5f67d56b2beb4a8b8ff3433eea054532@* belongs to Nickname1

I really need your help on this, I can't find any example of manipulating data like anywhere else.

Thanks so much in advance,

Cheers,

Jay

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Unfortunately mIRC doesn't support searching an ini file like it does a text file (reference /help $read)
To my knowledge you basically have two choices:
1) Use a loop to read the information from each line in the ini file, then see if there's a match.
2) Load the section of the ini file into a hash table, then use $hfind to search the hash table.

Personally I prefer the hash table method, as it is faster, due to the fact that the search is done in RAM, rather than having to read each line from the file on the hard drive.

Decide which method you prefer, then I, or another helper will probably be willing to write it up.

P.S: This sounds very familiar, if you have posted this on other sites, please check to ensure that you haven't already got an answer there.

Joined: Oct 2007
Posts: 214
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Oct 2007
Posts: 214
Hi Russel,

Thanks so much for the information.

It would definetly be nice and more of an asset if mIRC then did support it.

I think then it would definetly be easier then to substitute using a Hash Table system.

Thanks for all your help.

Cheers,

Jason



Link Copied to Clipboard