Sign in to follow this  
Followers 0

multiple lines in MsgBox?

21 posts in this topic

#1 ·  Posted

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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)

Share this post


Link to post
Share on other sites

#3 ·  Posted

Heh heh I was going to show this page and I think I was right . weeeeeeeeeeeeee got one .. lol

http://www.autoitscript.com/forum/index.php?showtopic=2848

Share this post


Link to post
Share on other sites

#4 ·  Posted

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!

Share this post


Link to post
Share on other sites

#5 ·  Posted

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.

Share this post


Link to post
Share on other sites

#6 ·  Posted

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)

Share this post


Link to post
Share on other sites

#7 ·  Posted

Concatenate.

Share this post


Link to post
Share on other sites

#8 ·  Posted

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.

Share this post


Link to post
Share on other sites

#9 ·  Posted

Please tell me you spelled "opposite" wrong intentionally, otherwise, that's too ironic.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

#11 ·  Posted

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

Share this post


Link to post
Share on other sites

#12 ·  Posted

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)

Share this post


Link to post
Share on other sites

#13 ·  Posted

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


Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#14 ·  Posted

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)

Share this post


Link to post
Share on other sites

#15 ·  Posted

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 ?

Share this post


Link to post
Share on other sites

#16 ·  Posted

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)

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#17 ·  Posted

Thanks JdeB !

I will do it like that.

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

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.

 

Share this post


Link to post
Share on other sites

#20 ·  Posted

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0