mIRC Home    About    Download    Register    News    Help

Print Thread
Writing multiple words for INI files #143232 22/02/06 10:25 AM
Joined: Aug 2004
Posts: 26
M
MercuryD Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Aug 2004
Posts: 26
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!

Re: Writing multiple words for INI files #143233 22/02/06 06:03 PM
Joined: Mar 2005
Posts: 420
X
xDaeMoN Offline
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
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.


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
Re: Writing multiple words for INI files #143234 22/02/06 07:11 PM
Joined: Aug 2005
Posts: 525
S
schaefer31 Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
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.

Re: Writing multiple words for INI files #143235 22/02/06 07:16 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
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.

Re: Writing multiple words for INI files #143236 22/02/06 07:50 PM
Joined: Feb 2005
Posts: 681
M
mIRCManiac Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
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

Last edited by mIRCManiac; 22/02/06 07:53 PM.
Re: Writing multiple words for INI files #143237 22/02/06 08:13 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
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

Re: Writing multiple words for INI files #143238 22/02/06 09:00 PM
Joined: Aug 2004
Posts: 26
M
MercuryD Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Aug 2004
Posts: 26
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."

Re: Writing multiple words for INI files #143239 22/02/06 09:40 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
//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

Re: Writing multiple words for INI files #143240 22/02/06 09:50 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
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

Re: Writing multiple words for INI files #143241 22/02/06 09:53 PM
Joined: Feb 2005
Posts: 681
M
mIRCManiac Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
Quote:
$+(",$did(201).seltext,")


$qt($did(201).seltext) wink

Re: Writing multiple words for INI files #143242 22/02/06 09:54 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Sure sure.. use those new fangled identifiers :P

-genius_at_work

Re: Writing multiple words for INI files #143243 22/02/06 09:58 PM
Joined: Feb 2005
Posts: 681
M
mIRCManiac Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
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.

Last edited by mIRCManiac; 22/02/06 10:03 PM.
Re: Writing multiple words for INI files #143244 22/02/06 10:01 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
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

Re: Writing multiple words for INI files #143245 23/02/06 01:08 AM
Joined: Aug 2004
Posts: 26
M
MercuryD Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Aug 2004
Posts: 26
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.

Re: Writing multiple words for INI files #143246 23/02/06 03:19 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
ah, completely misread his post.
/action returns to bed.