Re: Reading MS Word via AS ->crash??
Re: Reading MS Word via AS ->crash??
- Subject: Re: Reading MS Word via AS ->crash??
- From: Shane Stanley <email@hidden>
- Date: Fri, 22 Jun 2001 08:27:31 +1000
On 22/6/01 2:39 AM +1000, Charles Arthur, email@hidden, wrote:
>
So I was trying to set up a simple test for some words in some Word files.
>
You know the sort of routine -
>
>
--
>
set thefile to choose file --file is a Word 98 file
>
set openfile to open for access thefile
>
set thecontents to read openfile
>
close access openfile
>
>
set {od, AppleScript's text item delimiters} to {AppleScript's text item
>
delimiters, "Hoover"}
>
set thecontents to text items of thecontents
>
display dialog (count items of thecontents)
>
set applescript's text item delimiters to od
>
--
>
>
which works fine with, for example, a quite large Simpletext file. (If the
>
word you want is in the file you'll have more than 1 item in the list.)
>
>
Tried with a 24K MS Word 98 file, however, leads to Script Editor 1.4.3 (OS
>
904, CarbonLib 1.0.4) going down with all hands.
>
>
Howcome? What is the poison pill in Word file formats? Is there a way
>
around it when working with Word98 files?
You're reading a file that is not text format as if it were, so you're
results are going to be unreliable -- you should at least script Word to
save the file as text only first.
My _guess_ is that the problem is being caused by ASCII 0 characters, which
were problematic with some versions of AppleScript.
--
Shane Stanley, email@hidden