Re: Line count of a referenced text file?
Re: Line count of a referenced text file?
- Subject: Re: Line count of a referenced text file?
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 12 Nov 2001 23:28:15 -0500
- Organization: [very little]
>
Date: Mon, 12 Nov 2001 17:49:57 -0400
>
Subject: Line count of a referenced text file?
>
From: Matthew Broms <email@hidden>
>
To: Applescript Users <email@hidden>
>
>
Using purely AppleScript, can I get the line count of a text file using just
>
a reference to it (NOT reading the contents into a variable)? If I can, can
>
I get the count of any delimiter of my choosing? When I try to do a "count
>
paragraphs", I get an error.
Without reading the text file into a variable you can't do anything with
it. A reference to a file has to do with the file system (i.e. the file
as an entity), not with the contents of the file.
After you've read the text file into a variable you can use
AppleScript's text item delimiters to parse the text into paragraphs by
setting AppleScript's text item delimiters to "return". Then you can
count the number of items in the resulting list.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[11/12/01 11:27:38 PM]