Re: closing MSWord files -- Solved
Re: closing MSWord files -- Solved
- Subject: Re: closing MSWord files -- Solved
- From: Carl West <email@hidden>
- Date: Mon, 27 Nov 2000 15:54:25 -0500
- Organization: VPG Integrated Media
Carl West wrote:
>
>
I get the feeling that somehow I'm not closing the MS Word files
>
properly in the script below. I'm opening a .doc file and saving it as a
>
.txt file, then I want to change it's type and creator, but I get an
>
error that says:
>
>
Can't set file type of <valid pathname>
>
>
The code in question:
>
------------------------------
>
set fileNameString to (curFile as string) -- from the on open list
>
set fileName to ObjectNameFromPath(fileNameString) -- as above but
>
without the extension
>
>
tell application "Microsoft Word"
>
activate
>
open fileNameString
>
do Visual Basic " <VB that saves the file as a text file>"
>
>
set text item delimiters of AppleScript to ":"
>
close window (the last text item of (fileName & ".txt"))
>
end tell
This line:
>
set theFile to fileName & ".txt"
should be:
set theFile to ((fileName & ".txt") as alias)
Strings don't have file types. aliases do. works fine now.
Now I'm surprised the 'open fileNameString' command was working.
>
tell application "Finder"
>
set the file type of theFile to "TEXT"
>
set the creator type of theFile to "ttxt"
>
end tell
>
------------------------------
--
Carl West email@hidden
617.262.8830 x246
I have no superfluous leisure; my stay must be
stolen out of other affairs; but I will attend you awhile.
- Isabella, Measure for Measure, Act 3 Scene 1