Jump to content

Mutilple Lines in a MsgBox


Recommended Posts

Hey guys,

im at a bit of a loss on this one, its not listed anywhere under the MsgBox syntax in the helpfile, at least, not that i can see.

i have a HELP button on my progra, that throws up a msgbox with the help info in it. but i cant work out the equivilent of sending ENTER to the text.

say i wanted the following in the msgbox:

Help:

1: read c:\error.log for any errors once program is complete

2: email all support queires to "email@domain.com"

that sort of thing, but each on a diff line.

Cheers

/tAK

Link to comment
Share on other sites

MsgBox(0, "Title", "This is a long " & _
"string so just use '_'s to break them up.")

Or, depending on what you want(because it was a little unclear)

MsgBox(0, "Title", "Line One" & @CRLF & "Line Two")
Edited by AutoIt Smith
Link to comment
Share on other sites

defineately the second one.

the first one appears to have the effect of letting me break the text into line by line chunks int he code view.

but the second one breaks it down line by line when ran.

cheers for that. time to go write a help message :P

/tAK

Link to comment
Share on other sites

  • Moderators

defineately the second one.

the first one appears to have the effect of letting me break the text into line by line chunks int he code view.

but the second one breaks it down line by line when ran.

cheers for that. time to go write a help message :P

/tAK

The first one is just a line break so you can keep your code organized and still one string.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

MsgBox(0, "Title", "This is a long " & _
"string so just use '_'s to break them up.")

Or, depending on what you want(because it was a little unclear)

MsgBox(0, "Title", "Line One" & @CRLF & "Line Two")
In my code, I have gotten in the habbit of using both techniques together. Not becasue it's strictly necesary, just so that when reading the code I get an idea of what it will look like. I have dozens of production scripts in use to maintain these days, so going back and re-reading things I have forgotten happens a lot!

Example:

MsgBox(64, "This works fine", "This is the first line, showing:" & @CRLF & @Tab & "1. Using @CRLF for line breaks." & @CRLF & @Tab & "2. Using the '_' underbar line break in code." & @CRLF & "Hope that helps!   :-)")

MsgBox(64, "But this is easier to read and maintain", "This is the first line, showing:" & @CRLF & _
          @Tab & "1. Using @CRLF for line breaks." & @CRLF & _
          @Tab & "2. Using the '_' underbar line break in code." & @CRLF & _
          "Hope that helps!   :-)")

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...