mIRC Home    About    Download    Register    News    Help

Topic Options
#137758 - 18/12/05 08:52 PM using writeini (space in section)
sparkicks Offline
Pikka bird

Registered: 30/11/05
Posts: 11
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

Top
#137759 - 18/12/05 09:07 PM Re: using writeini (space in section)
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
I think you have to enclose it in quotes " "

example: writeini list.ini "access list" $$2 $$3

Top
#137760 - 18/12/05 09:08 PM Re: using writeini (space in section)
Aenei Offline
Ameglian cow

Registered: 17/11/05
Posts: 42
Loc: England
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


Edited by Aenei (18/12/05 09:12 PM)

Top
#137761 - 18/12/05 09:49 PM Re: using writeini (space in section)
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
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.

Top
#137762 - 18/12/05 09:56 PM Re: using writeini (space in section)
Aenei Offline
Ameglian cow

Registered: 17/11/05
Posts: 42
Loc: England
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.

Top
#137763 - 18/12/05 10:07 PM Re: using writeini (space in section)
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
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

Top
#137764 - 18/12/05 10:19 PM Re: using writeini (space in section)
Aenei Offline
Ameglian cow

Registered: 17/11/05
Posts: 42
Loc: England
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.

Top