Jump to content

[Solved] Formatting Text read from an INI file


Recommended Posts

Is there a way I can get AutoIt to evaluate the text read from an INI file? What I'd like to do is set up a small help file with a few items in it like:

[Help]
Item1 = "This is some help text" & @LF & "This is the second line of help text"
Item2 = This is item 2's help text, unlike the first Item this has only one line.
Item3 = "Item three has a few things such as numbered lists" & @LF & "1. You do not talk about Fight Club" & @LF & "2. YOU DO NOT TALK ABOUT FIGHT CLUB!" & @LF & "3. If this is your first night in the club, you have to fight."

When I try to put this in a msgbox it interprets it literally. What I'd like to do is have it do the proper line breaks and such. If this isn't the right method, please let me know the proper way to do what I'd like to accomplish.

Thanks,

WiSp

Edited by WiSp
Link to comment
Share on other sites

Use a special sequence for a new line and then search/replace it after reading:

[Help]
Item1=This is some help text\r\nThis is the second line of help text
Item2=This is item 2's help text, unlike the first Item this has only one line.
Item3=Item three has a few things such as numbered lists\r\n1. You do not talk about Fight Club\r\n2. YOU DO NOT TALK ABOUT FIGHT CLUB!\r\n3. If this is your first night in the club, you have to fight.

$Value = IniRead("iniFile.ini", "Help", "Item1")
$Value = StringReplace($Value, "\r\n", @CRLF)
MsgBox(64, "Help", $Value)

WBD

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...