mIRC Homepage
Posted By: MercuryD Writing multiple words for INI files - 22/02/06 10:25 AM
When using $readini, you can retrieve text with as many spaces as you wish, as it's separated by commas. However, as the /writeini command is not separated as such, you can't write an INI section with more than one word by default. Is there a way around this?
Code:
writeini scripts/Guide.ini "Two Words"  Reason Need to retrieve info!
msg $active $readini(scripts/Guide.ini, Two Words, Reason)

Need to retrieve info!
Posted By: xDaeMoN Re: Writing multiple words for INI files - 22/02/06 06:03 PM
You could replace the space with $chr(160) or an underscore ( $chr(95) ).

With the underscore, you will have to replace it back to a space when you retrieve the data.
Posted By: schaefer31 Re: Writing multiple words for INI files - 22/02/06 07:11 PM
You can also do <bold>_space_<bold> as this will work for any font since chr160 isn't a "blank space" in every font.

<bold> = ctrl + b
_space_ = a space, obviously.
Posted By: MikeChat Re: Writing multiple words for INI files - 22/02/06 07:16 PM
I don't know why it doesn't work for you
test
Code:
/writeini test.ini new line1 testing to see if multiple lines will write
then:
//echo -s $readini(test.ini,new,line1)

this works correctly for me.
Posted By: mIRCManiac Re: Writing multiple words for INI files - 22/02/06 07:50 PM
You're example will write this..
[new]
line1=testing to see if multiple lines will write

He wants to be able to write something like this..
[new section]
line 1=testing to see if multiple lines will write
I don't think that sections in an ini file are meant to have spaces in them. They should be replaced with another character, such as a _ (underscore).

However, you can write to sections with spaces by using quotes around the section name.

/writeini file.ini "new section" item data here

Apparently you can't do the same for the items.

-genius_at_work
Posted By: MercuryD Re: Writing multiple words for INI files - 22/02/06 09:00 PM
I've been trying that, and it doesn't seem to work. It's getting the data from a $did(4).seltext.
Code:
$iif($did(14).state == 1, writeini scripts/ACGuide.ini $("$did(201).seltext") Gotten Yes)
Wherein 201 is a list of items. 14 is a checkbox, so when you click on the item in 201 and check the box, it is written in the INI file that you have collected the item. The problem occurs when the title of the item is two words - I've been using two words because for reading purposes, it makes more sense for it to be displayed as "Red chair," and not "Redchair."
Posted By: SladeKraven Re: Writing multiple words for INI files - 22/02/06 09:40 PM
//writeini file.ini Some Section $replace(Some Item,$chr(32),$chr(95)) Some Data

[Some Section]
Some_Item=Some Data

There's also another solution that gets talked about alot on here. But is always argued against because it only works for certain fonts.

//writeini file.ini Some Section $replace(Some Item,$chr(32),$chr(160)) Some Data

[Some Section]
Some Item=Some Data

I'm not going to go through all the fonts to see which one works but mIRC's default Fixedsys will work. smile

-Andy
Try this:

$iif($did(14).state == 1, writeini scripts/ACGuide.ini $+(",$did(201).seltext,") Gotten Yes)

The $() identifier is used to evaluate. It is a shortcut to $eval().

The $+() identifier is used to concatenate (join) the items that are separated by commas.

-genius_at_work
Posted By: mIRCManiac Re: Writing multiple words for INI files - 22/02/06 09:53 PM
Quote:
$+(",$did(201).seltext,")


$qt($did(201).seltext) wink
Sure sure.. use those new fangled identifiers :P

-genius_at_work
Posted By: mIRCManiac Re: Writing multiple words for INI files - 22/02/06 09:58 PM
New identifiers are the candy in the store and I'm the kid. grin

~ Edit ~
btw, anyone checked out IE 7 ? tabbed browsing and everything.
Posted By: SladeKraven Re: Writing multiple words for INI files - 22/02/06 10:01 PM
I am deeply in love with "check", the list box's new property! Without the use of any custom DLL's it makes me wonder on what other dialog features we will see in the future. smile

-Andy
Posted By: MercuryD Re: Writing multiple words for INI files - 23/02/06 01:08 AM
Seems that worked! I'd tried $+() before with no quotation marks or commas, but this has solved my problems! Thanks a ton, all of you.
Posted By: MikeChat Re: Writing multiple words for INI files - 23/02/06 03:19 AM
ah, completely misread his post.
/action returns to bed.
© mIRC Discussion Forums