mIRC Home    About    Download    Register    News    Help

Print Thread
#179618 25/06/07 04:02 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Can you add colers to stuff writed in to a ini file?

or is it a limit in ini files?


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
No, you cannot put control codes into an INI unless you manually do so. However, you can convert them to something else, then convert them back later.

For example, if you know that your INI will never use ~, you can replace the Ctrl-K with ~ when writing the INI and replace the ~ with ctrl-k when reading the INI.

If you wanted to be more careful about what character is used, then write a group of characters in place of Ctrl-K... rather than just ~, you might use ^&@ or something.


Invision Support
#Invision on irc.irchighway.net
Joined: May 2007
Posts: 89
T
Babel fish
Offline
Babel fish
T
Joined: May 2007
Posts: 89
I've juste tested, and yes you can !
Try the following command:
Quote:
/writeini -n test.ini boom first $chr(3) $+ 04 $+ this is a test $+ $chr(3)

Then open the test.ini file to see your work :o)
Now, make a simple $readini using as second parm, 'p' instead of 'n'.
Quote:
//echo > $readini(test.ini,p,boom,first)

Reminder:
CtrlK = $chr(3)
CtrlB = $chr(2)
CtrlU = $chr(31)
CtrlO = $chr(15)
CtrlR = $chr(22)


tropnul
Joined: Jul 2006
Posts: 4,150
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,150
The problem is you use /writeini in the editbox with only one / and you already know that in remote, $chr(3) will be evaluated so you have to use $!chr(3).

You can use this method but the fact is that mirc not accept color his proper .ini file (create with /writeini)


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It isn't always a good idea to evaluate text that is read using $read or $readini. Especially text that can be set by a user other than yourself as the author of the script.

It's better imo, and safer, to $replace $chr(3) with some other character or characters and then $replace it back later.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard