Home > Archive > Visual FoxPro SQL Queries > January 2006 > Carriage Return in a variable









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Carriage Return in a variable
Kathy Weise

2006-01-08, 8:24 pm

I have a little routine that creates an email. I can put what ever I want in
the message body with something like:
lcBody="This is the message body part 1."+"And this is part 2."

but I can't figure out how to get a carriage return between the first string
and the second.

chr(13)+chr(10) doesn't work.
Any suggestions?

Kathy


Fred Taylor

2006-01-08, 8:24 pm

CHR(13)+CHR(10) is the correct way to do it. What doesn't work for you?
Depending on the system doing the displaying of the value, you may need only
the CHR(13) or just the CHR(10).

--
Fred
Microsoft Visual FoxPro MVP


"Kathy Weise" <kw@kathyweise.com> wrote in message
news:W0iwf.625$Hd4.360@newsread1.news.pas.earthlink.net...
>I have a little routine that creates an email. I can put what ever I want
>in the message body with something like:
> lcBody="This is the message body part 1."+"And this is part 2."
>
> but I can't figure out how to get a carriage return between the first
> string and the second.
>
> chr(13)+chr(10) doesn't work.
> Any suggestions?
>
> Kathy
>



Kathy Weise

2006-01-09, 3:24 am

Fred,
I've tried it with just one, but it does not work. Here is the whole
routine, since maybe I wasn't giving you the whole picture.

lcOutput="1234"
lcSubject="This is the subject"
lcBody = lcOutput+" records output. Second line of text should be on next
line."


DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, STRING cAction, STRING cFileName, ;
STRING cParams, STRING cDir, INTEGER nShowWin


lcMail = "mailto:notme@zzzz.com"+ ;
"?Subject="+ lcSubject+ ;
"&Body=" + lcBody
ShellExecute(0,"open",lcMail,"","",1)


I want to pass more variables to the body of the email, each on a separate
line.

Thanks,
Kathy



"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:OkYrNJMFGHA.2648@TK2MSFTNGP11.phx.gbl...
> CHR(13)+CHR(10) is the correct way to do it. What doesn't work for you?
> Depending on the system doing the displaying of the value, you may need
> only the CHR(13) or just the CHR(10).
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "Kathy Weise" <kw@kathyweise.com> wrote in message
> news:W0iwf.625$Hd4.360@newsread1.news.pas.earthlink.net...
>
>



Stefan Wuebbe

2006-01-09, 3:24 am

In emails the Windows standard carriage-return / linefeed
lcCRLF = Chr(13)+Chr(10)
does not work. Try
lcCRLF = "%0D%0A"
instead.


hth
-Stefan



--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------


"Kathy Weise" <kw@kathyweise.com> schrieb im Newsbeitrag
news:tpkwf.661$Hd4.317@newsread1.news.pas.earthlink.net...
> Fred,
> I've tried it with just one, but it does not work. Here is the whole routine, since
> maybe I wasn't giving you the whole picture.
>
> lcOutput="1234"
> lcSubject="This is the subject"
> lcBody = lcOutput+" records output. Second line of text should be on next line."
>
>
> DECLARE INTEGER ShellExecute IN shell32.dll ;
> INTEGER hndWin, STRING cAction, STRING cFileName, ;
> STRING cParams, STRING cDir, INTEGER nShowWin
>
>
> lcMail = "mailto:notme@zzzz.com"+ ;
> "?Subject="+ lcSubject+ ;
> "&Body=" + lcBody
> ShellExecute(0,"open",lcMail,"","",1)
>
>
> I want to pass more variables to the body of the email, each on a separate line.
>
> Thanks,
> Kathy
>
>
>
> "Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
> news:OkYrNJMFGHA.2648@TK2MSFTNGP11.phx.gbl...
>
>




Olaf Doschke

2006-01-09, 1:24 pm

> In emails the Windows standard carriage-return / linefeed
> lcCRLF = Chr(13)+Chr(10)
> does not work. Try
> lcCRLF = "%0D%0A"
> instead.


I'd like to add an explanation:

What does not work with CHR(13)+CHR(10)
is ShellExecute of a mailto: URL.

Since you execute a URL you must URL-Encode
CHR(13)+CHR(10) (CRLF), so you must use "%0d%0a"
or else the command ends with CRLF and the rest
(of the Body) is simply ignored.

ShellExecute is very similar to commandline and
within a commandline you also can't have a linefeed.

Bye, Olaf.



Kathy Weise

2006-01-09, 8:27 pm

Thank you both for a solution to my problem and to the explanation.

Kathy


"Olaf Doschke" < T2xhZi5Eb3NjaGtlQFNl
dG1pY3MuZGU@strconv.14
< T2xhZi5Eb3NjaGtlQFNl
dG1pY3MuZGU@strconv.14> wrote in message
news:%23PaThHUFGHA.2012@TK2MSFTNGP14.phx.gbl...
>
> I'd like to add an explanation:
>
> What does not work with CHR(13)+CHR(10)
> is ShellExecute of a mailto: URL.
>
> Since you execute a URL you must URL-Encode
> CHR(13)+CHR(10) (CRLF), so you must use "%0d%0a"
> or else the command ends with CRLF and the rest
> (of the Body) is simply ignored.
>
> ShellExecute is very similar to commandline and
> within a commandline you also can't have a linefeed.
>
> Bye, Olaf.
>
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com