mIRC Homepage

using writeini (space in section)

Posted By: sparkicks

using writeini (space in section) - 18/12/05 08:52 PM

right im using write ini
basicly
i tried in brackets and $+

writeini list.ini access $+ $chr(32) $+ list $$2 $$3
and
writeini list.ini (access list) $$2 $$3
Posted By: RusselB

Re: using writeini (space in section) - 18/12/05 09:07 PM

I think you have to enclose it in quotes " "

example: writeini list.ini "access list" $$2 $$3
Posted By: Aenei

Re: using writeini (space in section) - 18/12/05 09:08 PM

I had this problem. I got around it by renaming the space character tokenised list to one tokenised with underscores:
Code:
var %j = 1
set %desc $null
while ( %j <= $gettok($did($dname,2),0,32) ) {
  set %desc $addtok( %desc,$gettok($did($dname,2), %j, 32), 95 )
  inc %j
}

where the name of the ini file section is read from that dialog call and stored tokenised with underscores in %desc for use later in writing to the inifile.
To read it back from the ini file I used
Code:
var %j = 1
set %desc $null
while ( %j <= $gettok( $ini(%inifile, %i), 0, 95) ) {
  set %desc $addtok( %desc,$gettok($ini(%inifile, %i), %j, 95), 32 )
  inc %j
}

Here %desc, is the section title read back from the ini and retokenised using spaces. The path to the ini is %inifile

Edit: That post appeared whilst I was writing this, please tell me if the quotes work and I wasted a lot of time frown
Posted By: RusselB

Re: using writeini (space in section) - 18/12/05 09:49 PM

Rather than using the codes that you wrote up, you could've used
Code:
 set %desc $replace($did($dname,2),$chr(32),$chr(95)) 

and likewise to reverse it...I couldn't make a modification of your second code since you use %i in the code, but %i isn't set or evaluated in the code.
Posted By: Aenei

Re: using writeini (space in section) - 18/12/05 09:56 PM

Thats such a simpler way of doing it. Why didn't I think of that. %i is set somewhere else, but yes the second code could be altered in a similar manner without much bother.

Not to worry I'm probably going to recode the whole thing to use hash tables shortly anyway.
Posted By: RusselB

Re: using writeini (space in section) - 18/12/05 10:07 PM

when you recode for hash tables, rather than losing the information in your ini files, or having to redo it all again, remember the -i switch in /hload & /hsave
Posted By: Aenei

Re: using writeini (space in section) - 18/12/05 10:19 PM

Quote:
when you recode for hash tables, rather than losing the information in your ini files, or having to redo it all again, remember the -i switch in /hload & /hsave

Yup, well, as mentioned in my thread about ini's and hash tables, they're not quite importing right.
© 2022 mIRC Discussion Forums