mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2003
Posts: 149
S
Stealth Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Sep 2003
Posts: 149
Code:
/write test.ini Test [Brackets] 123
//echo -a $readini(test.ini, test, [Brackets]) == 123
//echo -a $ini(test.ini, test, 1) == ~Brackets~


Is this a bug?
A windows thing?
Or just what?

Is there any (sane) workaround?


mIRC 6.21 - Win XP Pro (SP2) - 2.4 Ghz - 1 GB Mem
irc.x-tab.org
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
/writeini should have been your first line, however i see what you mean, the item [brackets] is changed to ~brackets~ in the inifile, with a value of 123. I would take a guess this is a windows thing.

is a workaround really needed as the $readini using [brackets] does return the correct value?

I suppose for the $ini identifier you could do something like:
Code:
alias correctbrackets {
  if ( $left($ini($1,$2,$3),1) == ~ ) { 
    var %i = $replace($ini($1,$2,$3),~,$chr(91))
    if ( $right(%i,1) == $chr(91) ) {
      var %o = $left(%i,-1) $+ $chr(93)
      return %o
    }
  }
}

/writeini test.ini Test [Brackets] 123
//echo -a $readini(test.ini, test, [Brackets]) == 123
//echo -a $ini(test.ini, test, 1) == ~Brackets~
//echo -a $correctbrackets(test.ini,test,1) == [Brackets]

I know its a bit hackish and I'm sure there's a one line regex that does the same, but it works i guess...

btk




billythekid
Joined: Nov 2004
Posts: 842
Hoopy frood
Offline
Hoopy frood
Joined: Nov 2004
Posts: 842
I think it's a Windows thing.

The only work around I can think of would be converting all the non alphanum characters into hex values and then vica versa when reading them.

e.g. Hello! -> Hello%21


What do you do at the end of the world? Are you busy? Will you save us?
Joined: Sep 2003
Posts: 149
S
Stealth Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Sep 2003
Posts: 149
Originally Posted By: Jigsy
I think it's a Windows thing.

The only work around I can think of would be converting all the non alphanum characters into hex values and then vica versa when reading them.

e.g. Hello! -> Hello%21
Yes, I was thinking about doing exactly that, except just changing the brackets to (). This way they can be converted back without any confusion if they get reversed (eg, [Brackets] would be read the same as ]Brackets[)


mIRC 6.21 - Win XP Pro (SP2) - 2.4 Ghz - 1 GB Mem
irc.x-tab.org
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
as

//echo -a $readini(test.ini, test, ]Brackets[) == 123

shows.

I'd say this is a bug then, perhaps with mirc perhaps with windows, but a bug nonetheless(unless there's some protocol with []s and .ini files that we don't know of)

could it be that a topic inside an ini has brackets so maybe items under a topic cannot, or they would be parsed as new topics

btk

Last edited by billythekid; 08/01/07 06:52 PM.

billythekid
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: billythekid
could it be that a topic inside an ini has brackets so maybe items under a topic cannot, or they would be parsed as new topics


Exactly. You can't have [itemname] as the item in an INI file in Windows. Otherwise, windows has no way to know what is a topic and what is an item.

Without testing, I'm guessing that you also cannot have an = in the item name and you cannot have a ] in the topic name because those are used to indicate specific things in the INI file. Whether or not Windows/mIRC changes those as well as the []'s, I don't know.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard