Re: Soft returns in string variable?
Re: Soft returns in string variable?
- Subject: Re: Soft returns in string variable?
- From: Walter Ian Kaye <email@hidden>
- Date: Wed, 4 Feb 2004 09:58:18 -0800
At 07:13a -0500 02/04/2004, dave dowling didst inscribe upon an
electronic papyrus:
I'm doing some scripting with Apple Mail. If I manually copy all
the text from the body of an email, I can set a variable to the
clipboard like this:
[do manual copy]
set myParseText to the clipboard
etc...
and my script works fine. However, if I have AS set a variable with
the content of the email message like this:
set myParseText to (content of myMsg)
I get non-ASCII characters in my resulting string. When I copy the
unwanted characters into BBEdit and choose to show invisibles, they
show up as carriage returns. In FileMaker Pro, which is the end
point for my text variable, I get little squares instead of legible
characters. I know I can zap gremlins in BBEdit to get rid of the
unwanted characters, but I'm hoping there's a way to strip them in
AS alone. I really don't care about adding any other applications
to my script.
Any idea why a manual copy to the clipboard would be different from
an AS copy to the clipboard?
It sounds like Apple Mail must store the messages with CRLF line
endings. Which is how they exist during POP transport. So in fact
those *are* ASCII characters that you're seeing. (If my guess is
correct.)
More important, any idea how I can set a variable and strip out the
[...] characters?
First, see if Mail has any built-in way to get the text in Mac
format. If not, then see if this helps:
set myParseText to (content of myMsg)
set oldDelims to applescript's text item delimiters
set applescript's text item delimiters to ascii character 10
try
set myParseList to every text item of myParseText
set myParseText to myParseList as string
end try
set applescript's text item delimiters to oldDelims
Free at last! How I found peace with God: http://www.davedowling.com/peace.htm
Let me guess: you found it peaceful? ;)
Reporter: How did you find America?
A Beatle: Turned left at Greenland.
-boo
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.