closing MSWord files
closing MSWord files
- Subject: closing MSWord files
- From: Carl West <email@hidden>
- Date: Mon, 27 Nov 2000 13:18:22 -0500
- Organization: VPG Integrated Media
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
set theFile to fileName & ".txt"
tell application "Finder"
set the file type of theFile to "TEXT" --<<<<<<< this is where it
barfs >>>>
set the creator type of theFile to "ttxt"
end tell
------------------------------
All by itself as it's own droplet this works fine:
------------------------------
on open x
repeat with tFile in x
tell application "Finder"
set the file type of tFile to "TEXT"
set the creator type of tFile to "ttxt"
end tell
end repeat
end open
------------------------------
Any pointers? I'm new at this and I'm stuck.
--
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