Jump to content

multiple lines in MsgBox?


Guest cowsmanaut
 Share

Recommended Posts

Guest cowsmanaut

how do I get formatted text into a message box?

I can get a single line however I would like to be able to give multiple lines of information. ie:

Welcome (username)

todays date is (date)

it is about (time)

(OK)

can this be done? I've searched the help and looked at topics in here. don't see any direct examples.. perhaps I'm blind?

moo

Link to comment
Share on other sites

Just because I already had the file open, here's a freebee:

MsgBox(0, "Load Forecast Tool options", "/i or /install to install" & @CRLF &  "/u or /uninstall to uninstall" & @CRLF & @CRLF & "Load Forecast Tool written June '04 by Emmanuel Pleshe" & @CRLF & "©2004 Puget Sound Energy. All rights reserved.")

I had underscores at the end of each line, I took them out so as not to confuse you...

Edited by emmanuel

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Guest cowsmanaut

ok so @CRLF is the carriage return and line break together.. I didn't know you could combine them. That's cool .. should have figured this one out. up untill now I was making a txt file reading from it and the deleting it. I figured there had to be a better way!

One other thing I noticed is that you have a lot of "" & however when I try to do more than 3 &'s I get an error. I'll have to try again.

thanks for the info!

Link to comment
Share on other sites

Many text based applications (such as notepad.exe and MS Word) require the user of both the @CR and @LF character, which AutoIt calls @CRLF. However, when talking about message boxes, you can just use @LF if you would prefer. Or @CR, it doesn't really matter.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

ok so @CRLF is the carriage return and line break together.. I didn't know you could combine them. That's cool .. should have figured this one out. up untill now I was making a txt file reading from it and the deleting it. I figured there had to be a better way!

One other thing I noticed is that you have a lot of "" & however when I try to do more than 3 &'s I get an error. I'll have to try again.

thanks for the info!

the & combines strings (there's a word for it, I've seen it here a couple times, can't spell it for the damned of me, coconate?) you should be able to do as many as you want, just be sure you don't have any without anything between them... show us the code that errors?

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

One of the few words I can spell. It's not because I'm that great of a speller (because I am the polar opisite) but because it's a common command in Linux/ Unix. How's that for pathetic?

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

Yes and no. I spelled it wrong the first time arround, and choose to leave it when my spell check told me it was incorrect. It was too amusing not to leave :D

[Edit]: You know your a bad speller when you use a spell check before posting to forums, heh.

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

Guest Guest

Oh I found the issue I had 2 &'s together without anything between them.. I think I had edited out something and missed one.. didn't notice untill after..

moo

Link to comment
Share on other sites

Oh I found the issue I had 2 &'s together without anything between them.. I think I had edited out something and missed one.. didn't notice untill after..

moo

I wonder if this is something that Tidy could check?

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

  • Developers

I wonder if this is something that Tidy could check?

Why would you want this when Autoit it reports these errors ?

Tidy up till now only reports errors when it gets confused with the indenting...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Why would you want this when Autoit it reports these errors ?

Tidy up till now only reports errors when it gets confused with the indenting...

oh, I dunno, I tidy before I compile before I test... it'd tip me off sooner... but I'm guessing most people test before they compile (I don't have the app I'm trying to automate on my pc...)

it's cool, I'm a freak, no worries.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

I'm trying to get the hang of V3, so far so good untill ...

I have to display several msg boxes based on variables, something like MsgBox(0,$Title,$Msg)

Both variables are being read from an ini-file.

The line reads = "Text" & @CRLF & "Text"

When I use this and call the MsgBox I get an exact quote as what I entered.

Can you tell me what I'm doing wrong ?

Link to comment
Share on other sites

  • Developers

when you read it from the ini file like:

$txt = iniread($file,$section,$key)

$txt contains '"Text" & @CRLF & "Text"'... in other words: one string...

You could do it this way:

$txt = 'Text\nText'  ; put \n where ever you want a newline.
$txt = stringreplace($txt,'\n',@LF) ; replace \n for @LF
MsgBox(0,'test',$txt)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • 5 years later...

when you read it from the ini file like:

$txt = iniread($file,$section,$key)

$txt contains '"Text" & @CRLF & "Text"'... in other words: one string...

You could do it this way:

$txt = 'Text\nText'  ; put \n where ever you want a newline.
$txt = stringreplace($txt,'\n',@LF) ; replace \n for @LF
MsgBox(0,'test',$txt)

I have same trouble with new line in iniread . but it happend with GUICtrlCreateLabel

Ex:

$text1 = IniRead("config.ini", "Config", "text1", "Error")

$Group_3 = GUICtrlCreateLabel($text1,15,18,210,65)

and Config.ini file :

[config]
$text1 = "line1" & @CRLF & "line2" ; << not work with new line

[config]
$text1 = "line1\line2" ; << not work too

My English not good . :D Plz help me .

Edited by Born2Try
Link to comment
Share on other sites

This post is from 2004 O_o

And to help you use stringreplace like JdeB sugested to replace \n with @CRLF (start testing from the help file on String* commands)

Edit: and next time you shud open your own topic wiht your own problem instead resurecting one that is opened from 2004

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

This post is from 2004 O_o

And to help you use stringreplace like JdeB sugested to replace \n with @CRLF (start testing from the help file on String* commands)

Edit: and next time you shud open your own topic wiht your own problem instead resurecting one that is opened from 2004

At least this shows that he used the search. :D

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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...