Re: AppleScript to Combine Several .doc Files
From: Paul Berkowitz (berkowit_at_spoof_silcom.com)
Date: 09/16/04
- Next message: henryn: "Re: Prevent Word view-only from munching mod date?"
- Previous message: Jim Gordon MVP: "Re: Using Excel Data in Word Dynamically"
- In reply to: Sam Elowitch: "AppleScript to Combine Several .doc Files"
- Next in thread: Sam Elowitch: "Re: AppleScript to Combine Several .doc Files"
- Reply: Sam Elowitch: "Re: AppleScript to Combine Several .doc Files"
- Reply: Fredrik Wahlgren: "Re: AppleScript to Combine Several .doc Files"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 15 Sep 2004 20:35:15 -0700
On 9/15/04 2:51 PM, in article BD6E31A6.EDBC%selowitch@gwi.net, "Sam
Elowitch" <selowitch@gwi.net> wrote:
> Is there an AppleScript that sequentially combines a folder full of Word
> docs into a single document?
1. Copy and paste the following script into Script Editor
(/Applications/AppleScript/).
2. Save it (named "Combine Word Docs") as an Application, anywhere
convenient. You can drag it into the dock if you wish.
3, Re-name - or make copies of your docs and rename the copies - so that
they appear in list or column view in the order in which you wish to combine
them (i.e. alphabetical order).
4. Command-click or shift-click all the documents you wish to combine to
select them all.
5. Drag them onto the applet you saved ("Combine Word Docs").
6. The combined doc will be open in Word. Name it and save it in the usual
manner.
on open theFiles
tell application "Microsoft Word" to set comboDoc to make new document
repeat with i from 1 to (count theFiles)
set theFile to item i of theFiles
set filePath to theFile as Unicode text
tell application "Finder"
set {creaType, fileType} to {creator type, file type} of theFile
set ext to name extension of theFile
set fileName to name of theFile
end tell
if (creaType is "MSWD" and {fileType} is in {"BINA", "W8BN", "s8BN",
"W6BN", "s6BN", "RTF "}) or ext = "doc" then
tell application "Microsoft Word"
set comboRange to text object of comboDoc
set collapsedRange to collapse range comboRange direction
collapse end
insert file file name filePath at collapsedRange
end tell
end if
end repeat
tell application "Microsoft Word" to activate
end open
-- Paul Berkowitz MVP MacOffice Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html> AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/> Please "Reply To Newsgroup" to reply to this message. Emails will be ignored. PLEASE always state which version of Microsoft Office you are using - **2004**, X or 2001. It's often impossible to answer your questions otherwise.
- Next message: henryn: "Re: Prevent Word view-only from munching mod date?"
- Previous message: Jim Gordon MVP: "Re: Using Excel Data in Word Dynamically"
- In reply to: Sam Elowitch: "AppleScript to Combine Several .doc Files"
- Next in thread: Sam Elowitch: "Re: AppleScript to Combine Several .doc Files"
- Reply: Sam Elowitch: "Re: AppleScript to Combine Several .doc Files"
- Reply: Fredrik Wahlgren: "Re: AppleScript to Combine Several .doc Files"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|