Re: reading paragraphs from a file
Re: reading paragraphs from a file
- Subject: Re: reading paragraphs from a file
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 6 Dec 2007 12:03:11 -0500
You can't get the paragraphs of a file handle, which is what you're
trying to do - the number you're seeing is the numeric value of the
file descriptor, which is essentially meaningless.
You need to read the contents of the file and then get the paragraphs
of that... and you can do that without having to explicitly open the
file:
set temp_path to "/private/tmp/p.txt"
set temp_file to POSIX file temp_path
set paras to paragraphs of (read temp_file)
On Dec 6, 2007 11:49 AM, Alex Morken <email@hidden> wrote:
> Hello,
>
> When executing the script below I am getting the following error --
> "Cannot get every paragraph of 697". Each time I run the script the
> number increases by one. The txt file I am reading from contains 1
> line and will never grow beyond that. I am not sure why the number
> of paragraphs would be increasing (if that is what it is saying).
>
> set tempdir to "/private/tmp/p.txt"
> set fpath to POSIX file tempdir
> set f to open for access file fpath
> set r to paragraphs of f
> display dialog r
> set r to nothing
> close access f
>
> Thank you,
> Alex Morken
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden