Re: The disappearing script execution!
Re: The disappearing script execution!
- Subject: Re: The disappearing script execution!
- From: Shane Stanley <email@hidden>
- Date: Fri, 17 Aug 2001 09:21:54 +1000
On 17/8/01 4:46 AM +1000, Matthew Broms, email@hidden, wrote:
>
I have a self-contained script which I call from Filemaker Pro 5 which
>
simply goes out and reads 6 separate text files (1 each in a repeat loop -
>
some are very large, 2-3mb), counts the number of paragraphs and compares
>
the results with those statically recorded in the database. If they are the
>
same it states that, if they are different, it adjusts the numbers in the DB
>
and states it did so. It mostly works fine, but occasionally it acts very
>
strangely and just stops while reading one of the files (random - sometimes
>
the first file, sometimes middle file, sometimes the last file). It doesn't
>
error out and it never gets to the compare statement and subsequent display
>
dialogs. It just disappears.
I can't see any obvious problem, but I can see that you're doing a lot of
unnecessary work that makes the script harder to follow. You don't need to
do all that tracking of where you're up to in the file -- it's all done for
you automatically.
Here's part of your script re-written to show what I mean:
set tempFile to open for access file theFile
set blockSize to 100000
set fileSize to get eof tempFile
if fileSize < blockSize then
set blockSize to fileSize
end if
repeat
try
set rawData to read tempFile for blockSize
on error -- no more data
close access the tempFile
exit repeat
end try
set tempCount to tempCount + (count of paragraphs of rawData) - 1
dd set contents of item 4 of d1 to tempCount as string
end repeat
--
Shane Stanley, email@hidden