Sign in to follow this  
Followers 0
jtsteffen

White Space being added to End of Text

12 posts in this topic

#1 ·  Posted (edited)

Hello

I've written some code that automatically creates an e-mail for a person to send into our support people with an unlock code. When I create the e-mail everything looks okay except one thing. At the end of each line there is an extra space that gets added. No matter what I do, I keep getting that space.

I want the user to be able to double click on the unlock code and only select the characters. However when they double click on the code now, it selects the unlock code but also selects the space at the end of the line.

Anyone know what I'm doing wrong and how to fix this. Thanks

#include <INet.au3> 
Dim $viKey[1][5]                                                    ; Create Array for Encryption Info
$viKey[0][3]="Program Name"
$viKey[0][4]="help@abce.com"

Local $vsRegLock="ABCDEFGHIJKLMNOPQRST"
    _INetMail($viKey[0][4], "Unlock:  " & $viKey[0][3], "Please unlock the program requested in the Subject" & @CR _
        & @CR & StringLeft($vsRegLock, 20) & @CR & @CR & "Thank you.")  ;                           ***
Edited by jtsteffen

Share this post


Link to post
Share on other sites



Why are you mixing your EOL (End Of Line) characters like this: "@LF & @CR & @CR"?? That can't be helping anything.

Share this post


Link to post
Share on other sites

Why are you mixing your EOL (End Of Line) characters like this: "@LF & @CR & @CR"?? That can't be helping anything.

Part of that was actually me trying to get rid of the space. I am using the @CR to end the line and start typing the message on the next line. Do you have a better way of doing this? Two in a row is suppose to give me a blank line between the text.

Share this post


Link to post
Share on other sites

Have a look at StringStripWS in the help.

Share this post


Link to post
Share on other sites

Have a look at StringStripWS in the help.

Yep, tried that. It didn't work. I also tried using StringLeft()

I suspect it has something to do with adding the @CR in the lines as the first guy mentioned, but I do not know of another way to add a carrage return.

Share this post


Link to post
Share on other sites

Ascii chr 10 and 13.

Share this post


Link to post
Share on other sites

Ascii chr 10 and 13.

I'm afraid no joy. It is looking like an Outlook thing. It looks like it shows the charage returns as spaces in the message.

#include <INet.au3> 
Dim $viKey[1][5]                                                    ; Create Array for Encryption Info
$viKey[0][3]="Program Name"
$viKey[0][4]="help@abce.com"
Local $vsRegLock="ABCDEFGHIJKLMNOPQRST"
Local $Message= "Please unlock the program requested in the Subject." & CHR(13) & CHR(13) & $vsRegLock & CHR(13) & CHR(13) & "Thank you."
    _INetMail($viKey[0][4], "Unlock:  " & $viKey[0][3], $Message)

Share this post


Link to post
Share on other sites

It looks like the mailto handler is adding the spaces at the end of each line.

If I call this URL from my browser, then the Thunderbird e-mail client opens and the same thing happens.

mailto:abc@test.com?subject=test&body=line1%0D%0Aline2

Probably nothing you can do about it from AutoIt.

Maybe you can put the unlock code on the last line of the e-mail? That way not extra spaces are added.

Share this post


Link to post
Share on other sites

Good Idea on trying to add it at the end. In this case that would be a okay way to make it work. I would still like to know if anyone has a way to kill it.

I did try putting it at the end, but it still added the space. You would think this was an easy thing to fix. ;)

Share this post


Link to post
Share on other sites

This is confusing, but I thought that CR was considered to be a space character. What happens if you replace @CR & @CR with @CRLF?

Share this post


Link to post
Share on other sites

This is confusing, but I thought that CR was considered to be a space character. What happens if you replace @CR & @CR with @CRLF?

On windows, @CRLF is a linebreak, but in reality it is two characters: @CR & @LF

Don't ask why, it seems a stupid way to do it.

Share this post


Link to post
Share on other sites

I'm afraid no joy. It is looking like an Outlook thing. It looks like it shows the charage returns as spaces in the message.

#include <INet.au3> 
Dim $viKey[1][5]                                                    ; Create Array for Encryption Info
$viKey[0][3]="Program Name"
$viKey[0][4]="help@abce.com"
Local $vsRegLock="ABCDEFGHIJKLMNOPQRST"
Local $Message= "Please unlock the program requested in the Subject." & CHR(13) & CHR(13) & $vsRegLock & CHR(13) & CHR(13) & "Thank you."
    _INetMail($viKey[0][4], "Unlock:  " & $viKey[0][3], $Message)

Outlook is a disaster area in terms of adding extra spaces/blank lines to text. Outlook also can insert non-standard spaces. Use a hex editor to view the space that stringstripWS isn't removing, and I'll bet it isn't = 20.

Stringreplace might work if you find out the hex of the character that is there. I'd be very interested if you find a solution.

D

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