Re: (no subject)
Re: (no subject)
- Subject: Re: (no subject)
- From: Nigel Garvey <email@hidden>
- Date: Tue, 19 Feb 2002 11:34:04 +0000
Shane Stanley wrote on Tue, 19 Feb 2002 11:54:42 +1100:
>
On 19/2/02 10:32 AM +1000, Pat Cannon, email@hidden, wrote:
>
> repeat
>
> try
>
> set nextPointer to pointer + chunkSize
>
> set pdfText to read pdfFile from pointer to nextPointer
>
> if pdfText contains searchString then
>
> set textFound to true
>
> exit repeat
>
> end if
>
> on error -- I'm assuming the error is EOF
>
> exit repeat
>
> end try
>
> set pointer to nextPointer
>
> end repeat
>
But you're not allowing for the possibility of "CalGray" falling across the
>
boundary of two chunks. To be safe, you need to do something like store the
>
last paragraph of each chunk, then concatenate the next chunk to it each
>
time.
Or, at the end of the loop, set pointer to nextPointer - searchString's
length + 1.
>
You would also speed things up a fair bit if you used "open for
>
access"/"close access"; as it stands, opening and closing being done
>
(automatically) each time you read.
Seconded. Open the file before the first read; close it only when you hit
an error or find the text. And, of course, use the reference returned by
'open for access' (not the file alias) with the read command.
NG
_______________________________________________
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.