mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Why can't mIRC write more than 64KB in ini file? #35897 12/07/03 08:33 AM
Joined: Feb 2003
Posts: 282
S
saragani Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
Using writeini I'm getting an error while trying to write more than 64KB into an ini file.

Then I tried to use the -n switch which suppose to let me write more than 64 KB. (The help file says "mIRC will attempt to write .....").

Is it suppose to write more than 64KB, or will it just attemp, and then do nothing??

Is there any way that I can write more than 64KB?

Re: Why can't mIRC write more than 64KB in ini file? #35898 12/07/03 12:41 PM
Joined: Jan 2003
Posts: 96
J
Jesper Offline
Babel fish
Offline
Babel fish
J
Joined: Jan 2003
Posts: 96
use /write -n

Code:
/writeini -n <inifile> <section> <item> <value>
Writes to files in the standard INI file format.

If the -n switch is specified, mIRC will attempt to write to the .ini file even if it is larger than 64k.

Re: Why can't mIRC write more than 64KB in ini file? #35899 12/07/03 05:10 PM
Joined: Dec 2002
Posts: 127
F
feud Offline
Vogon poet
Offline
Vogon poet
F
Joined: Dec 2002
Posts: 127
not only did you tell him to use the wrong command "/write -n" instead of "/writeini -n", you didn't even read his post. he said he has already tried that. good work.

to original poster: i'm assuming that because the help file says that /writeini will 'attempt' to write to the file, it might not work in all cases. maybe try storing your data in a different format.


------
deep down, i'm really superficial.
Re: Why can't mIRC write more than 64KB in ini file? #35900 12/07/03 05:54 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
tisk tisk jesper..

anyways, i believe its a windows issue with writing to an ini file. If its not window, it may be a mirc issuaue with only allowing a 64k buffer.

What exactly are you writing to an ini to make one that large? You think of breaaking your ini's down into parts. If your using an ini for a user base, you may also consider hash tables. They are both more efficient and much easier to deal with (imo).

/help /hmake >:D


-KingTomato
Re: Why can't mIRC write more than 64KB in ini file? #35901 12/07/03 06:04 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
I'm looking at microsoft's documentation on how to write to ini files and I don't see any builtin limit, so it must be mIRC...

Re: Why can't mIRC write more than 64KB in ini file? #35902 12/07/03 06:06 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Can you point me to the page? I'd like to learn about them while im at it laugh


-KingTomato
Re: Why can't mIRC write more than 64KB in ini file? #35903 12/07/03 06:12 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Gotta find the page, I have the documentation locally :P Basically I assumed that mIRC uses the Windows function WritePrivateProfileString which is the only Windows function I know of that writes to an ini (note that this function is obsolete and the documentation says don't use ini's, use the registry). The information is really more how to write to ini's using C/C++ than in general, but if you're interested, http://msdn.microsoft.com/library/defaul...ofilestring.asp

Re: Why can't mIRC write more than 64KB in ini file? #35904 12/07/03 06:21 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Thats what i wanted, was C\C++. I am getting into windows api, and just want to fool with saving also. I figure i'll save dialog information to an ini to kill two birds with one stone. laugh ty


-KingTomato
Re: Why can't mIRC write more than 64KB in ini file? #35905 12/07/03 06:24 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
If you are learning Windows API, I'd recommend two books to you, "Programming Windows 5th Edition" by Charles Petzold. That book is considered the bible of winapi, and "Programming Applications for Microsoft Windows" by Jeffery Richter. That one gives you info on some stuff that is very useful, like how to work with threads and things like that. They are very useful books to have (not cheap though).

Re: Why can't mIRC write more than 64KB in ini file? #35906 12/07/03 06:31 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Yes, i did happen to go out and but the .net edition of windows api, but im starting to believe i need to crawl before i can walk. This book looked like it was from a beginer's standpoint, but as i go further they start with "the dialog that ate cinccinatti".. Over 20 id's >:\

I'll have to consider making a run to the good ol barns and nobles >:D


-KingTomato
Re: Why can't mIRC write more than 64KB in ini file? #35907 12/07/03 08:14 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Nah, b&n rips you off on computer books, www.bookpool.com has the best prices I've found, but they only sell computer and technology books.

Re: Why can't mIRC write more than 64KB in ini file? #35908 12/07/03 09:02 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
One problem--im 17 and no credit card >:D Other than that, i can buy online.. heh

EDIT: Besides i think i have a free book coming to me with that book club deal watever. >:D


-KingTomato
Re: Why can't mIRC write more than 64KB in ini file? #35909 12/07/03 11:06 PM
Joined: Jan 2003
Posts: 96
J
Jesper Offline
Babel fish
Offline
Babel fish
J
Joined: Jan 2003
Posts: 96
Oooops, my bad, am truly sorry for that. frown

Re: Why can't mIRC write more than 64KB in ini file? #35910 12/07/03 11:49 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
You need to do like I did,

"Mom, consider this, it's 2am, I'm in the middle of nowhere, out of money, and the car just ran out of gas... Do you want me to have to wait at some run down gas station in the middle of nowhere for hours until you get there to pay for gas for me? Wouldn't it just be better to give me a credit card in case of an emergency?"

It works smile

Re: Why can't mIRC write more than 64KB in ini file? #35911 12/07/03 11:52 PM
Joined: Jan 2003
Posts: 96
J
Jesper Offline
Babel fish
Offline
Babel fish
J
Joined: Jan 2003
Posts: 96
hahah that was a good one code, does it actually work ?

Re: Why can't mIRC write more than 64KB in ini file? #35912 12/07/03 11:54 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well I've had a credit card since I started driving (17), so it worked for me smile

Re: Why can't mIRC write more than 64KB in ini file? #35913 13/07/03 11:49 AM
Joined: Feb 2003
Posts: 282
S
saragani Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
One problem that I have is that I don't know how to use hash tables.

Re: Why can't mIRC write more than 64KB in ini file? #35914 14/07/03 02:36 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Well, to make one use
/hmake <name> <size>

the size is generall the square root of how many items you expct to have. For example if you expect to have 100 items, 10 is fine. So lets say we're storing acronyms for chatting. 100, is a good number, so we'll use 10

Code:
/hmake acronym 10


Okat, so now we have the hash table, now we want to add some items. Here is where /hadd come in. You simply type /hadd <hash_table> <value_name> <value>. So for example, lets add a few acrnyms to our hash table..

Code:
/hadd acronym afk Away From Keyboard
/hadd acronym brb Be Right Back
/hadd acronym lol Laughing Out Loud
/hadd acronym ttyl Talk To You Later


Okay, so not we have a had table, and four values. Now, we have the data but how do we use it? Well, for this example lets just use a simple on input event. We will take the user's input, look for our acronyms, and then replace as needed.

For matching and checking a value exists in the has table, we use $hget(hash_table, value_name) (And just $hget(<hash_table>) to see if the table exists). If it returns a value, the item is set, otherwise no value exists. Lets cycle through the words

Code:
on *:INPUT:#: {
  if ($left($1, 1) !isin $+(/,$readini($mircini,text,commandchar))) {
    ; check if the hashtable exists
    if ($hget(acronym)) {
      var %w = 1, %word, %msg
      while (%gettok($1-, %w, 32)) {
        %word = $ifmatch
        if ($hget(acronym, %word)) %text = %text $+([,$ifmatch,])
        else %text = %text %word
        /inc %w
      }
      /msg $active %msg
      /halt
    }
  }
}


Okay, so now we went through each word, found any and all matching words, and replaced them. Now, the message shoudld be like this:

Input: that was a funny joke, lol
Output: that was a funny joke, [Laughing Out Loud]

Okay, now we have all the information, but how do we save it? Well, now we get to /hsave and /hload, which will save and load our table respectivly. Okay, so say we want all the acronyms save to a file called acronyms.hsh when we close mirc. To do this, we use on EXIT, and the hsave command.

Code:
on *:EXIT: {
  ; if our table exists (was created)
  if ($hget(acronym)) {
    ; save it (-o means overwrite existing file (we don't need it anymore))
    /hsave -o acronym acronyms.hsh
  }
}


Okay, so now we made our table, we added information, we used the table and saved it--now what. Well, now what we do is load it on our next running of tribes. For this we look at on start.

Code:
on 1:START: {
  ; intialize hash table
  /hmake acronym 10
  ; now, if the file we want to load from existsa, load it..
  if ($isFile(acronyms.txt)) /hload acronym acronyms.hsh
}


And there we go. Now we have a hash table that is used to replace acronyms. Its a simple script, but is a nice little beginner's starting point. Hope this helps, and if you have any questions, thats what the forums are here for!

grin


-KingTomato
Re: Why can't mIRC write more than 64KB in ini file? #35915 14/07/03 11:48 AM
Joined: Feb 2003
Posts: 282
S
saragani Offline OP
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Feb 2003
Posts: 282
W00t grin grin grin

This is a very nice example which covers it all.

Thanks. It was realy helpfull. Now I jsu need to convert my script to a hash table based.

Thanks

Re: Why can't mIRC write more than 64KB in ini file? #35916 16/07/03 03:44 PM
Joined: Jun 2003
Posts: 68
D
Dr4g0n Offline
Babel fish
Offline
Babel fish
D
Joined: Jun 2003
Posts: 68
/help /write

Page 1 of 2 1 2