Re: Return or No Return
Re: Return or No Return
- Subject: Re: Return or No Return
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 23 Mar 2006 13:32:00 -0800
- Thread-topic: Return or No Return
On 3/23/06 1:18 PM, "Luther Fuller" <email@hidden> wrote:
> I have a script with the line
>
> set textLine to read refNr before return
>
> I use the script to read plain text files saved from Eudora and it
> has worked correctly for years.
> Now, I'm trying to read plain text files saved from Mail and I've
> found that 'read' incorrectly reads the whole document.
> Mail documents DO contain return characters. I've verified this by
> opening them with TextEdit and TextWrangler.
> So, why does 'read before return' ignore the return character?
Are you sure they're actually return characters (ASCII 13)? Saved from Mail
wouldn't they actually be Unix line feed characters (ASCII 10)?
You can
set lf to (ASCII character 10)
set textLine to read refNr before lf
And just maybe they're actually in Unicode plain text files? You need to use
'as Unicode text' with the 'read' command if that's the case. I'm not sure
how that works with parameters like 'before'. I.e. I'm not certain this
works:
set textLine to read refNr as Unicode text before lf
It might not. I usually read a whole Unicode text file in at once, then get
its paragraphs, and work one one at a time in a repeat loop.
(You should not have to 'set lf to (ASCII character 10) as Unicode text' but
it wouldn't hurt.)
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden