Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

An AppleScript to reduce large Word file sizes Apps
As you may know, Microsoft Word has the habit of messing up with big documents. As you work on them, they get bigger and bigger, and often a day comes when word starts crashing the document. This is because Word remembers everything you do to your document. For instance, if you add an image, save and close your document, open again your document, delete your image, save your document, your file will be much bigger than before, even though the image is no longer there. This is because word will remember that you added an image and then deleted it.

The solution is to:

  1. Open your document in word
  2. Select all your text
  3. Copy all your text
  4. Create a new document
  5. Paste all your text
  6. Save the copy, and delete the original
This can do wonders for your file sizes! I have already reduced by ten times some of my largest documents using this trick. So I spent the evening writing this little AppleScript to do the work for me.

Read the rest of the hint for the script.

on open (theItems)
  repeat with aFile in theItems
    tell application "Finder"
      set fileRef to (a reference to file aFile)
      set FileName to fileRef as string
      tell application "Microsoft Word"
        activate
        open fileRef
        set mic to select text of last document
        copy
        close last document
        tell application "Finder"
          move fileRef to trash
        end tell
        make new document
        paste
        save last document in FileName
        close last document
      end tell
    end tell
  end repeat
end open
To use the script, open Script Editor, copy and paste the script, and save it as an application. Then drag and drop (onto the script icon) the Word documents you want to clean up (but nothing else!). I hope some will find it useful.

[robg adds: I haven't tested this script myself, but it looks quite straightforward.]
    •    
  • Currently 1.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[15,391 views]  

An AppleScript to reduce large Word file sizes | 13 comments | Create New Account
Click here to return to the 'An AppleScript to reduce large Word file sizes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to reduce large Word file sizes
Authored by: rheathcott on May 21, '03 10:18:22AM

I believe your problem is "Fast Saves". Just disable that in the preferences and this won't happen. For documents you have already created, just do a "Save As..." and save under a different name. This has been around forever.



[ Reply to This | # ]
Don't allow "fast saves"
Authored by: ebow on May 21, '03 10:22:14AM

Why not just go to Word's preferences, in the "Save" section, and make sure the "Allow fast saves" checkbox is cleared? I haven't formally tested it, but in prior use I've found that filesize drops when I uncheck it, or doesn't climb nearly as rapidly when it's never checked in the first place.

Also, wouldn't the method listed above lose all the headers and footers, among other things?



[ Reply to This | # ]
An AppleScript to reduce large Word file sizes
Authored by: dhayton on May 21, '03 10:27:11AM

Isn't the problem of growing MS Word files related to the preference "Allow fast saves"? This certainly used to be the case, and when you deselected the "Allow fast saves" (in the "Save" preferences) the file sizes remained reasonable.

I must confess that I haven't experienced the problem of growing file sizes for some time (this preference was the key to the problem in MS Word 5.1 through 98 in OS 9). I use Word quite a lot and some of my chapters are in the neighborhood of 15-20 MB once all the pictures and figures are added. I might add that this is just the size I would expect when adding the file sizes of the various illustrations and the text itself.

Am I lucky, or are my files still too small to notice a difference?

Best,
darin



[ Reply to This | # ]
An AppleScript to reduce large Word file sizes
Authored by: sfodden on May 21, '03 10:40:38AM

I'm a recent convert to Mac, so my Windows understanding may not translate, but in that OS Word would indeed grow huge files. The solution there was very like the hint posted, except that you would move the cursor one space up, after selecting all the text (i.e. selecting all but the last, invisible, "space"); then you would copy and paste into a new document. This was because the info that Word had gathered about the document was stored in that last invisible space, and that was what you wanted to leave behind.

---
Simon F.



[ Reply to This | # ]
An AppleScript to reduce large Word file sizes
Authored by: lrivers on May 21, '03 01:21:51PM

I believe doing a "Save As..." achieves the same result...



[ Reply to This | # ]
An AppleScript to reduce large Word file sizes
Authored by: pmbuko on May 21, '03 02:40:41PM

Yes, Save As... works, but you have to use a different file name.



[ Reply to This | # ]
An AppleScript to reduce large Word file sizes
Authored by: NovaScotian on May 21, '03 02:55:08PM

Interesting: I never allow fast saves, so I ran two large documents through this script and surprisingly, both came out larger than they went in: 44K -> 48K, and 108K -> 150K
Wow!



[ Reply to This | # ]
Stops Crashes Too!
Authored by: luhmann on May 21, '03 05:59:38PM

I've long been doing this to stop Word from crashing. Doing this can help a lot when a file always hangs with a spinning cursor! Save As does not achive the same results.



[ Reply to This | # ]
An AppleScript to reduce large Word file sizes
Authored by: crunchyfrog on May 21, '03 06:09:31PM

Save As.. does the trick but if you haven't used any of the later Word formatting features, try saving the document as a Word5 for Mac document - you will get really huge savings then. - great if you're emailing the document to someone (but then why email a Word doc when you could email .rtf or .txt)



[ Reply to This | # ]
An AppleScript to reduce large Word file sizes
Authored by: mmmmark on May 21, '03 06:18:57PM

I'm a tech writer and unfortunately am forced to work in Word (on a PC) all day. I create huge docs and experience this file bloat syndrome daily.

Everyone is correct about leaving off fast saves, but that is just the tip of the iceberg. Documents still balloon. Reviewing, commenting, tracking changes--ALL these things are never purged from a document, even when you "Save As". I work on docs that get well over 10 megs, so this is important to know.

The solution mentioned in this thread is ok for simple docs. It does not work well when documents have multiple sections, headers/footers, TOCs, styles, and other complex attributes. I wish MS would offer a way to purge old data much like is done in Access databases. Sigh.



[ Reply to This | # ]
An AppleScript to reduce large Word file sizes
Authored by: Safar on May 22, '03 03:47:02PM

Have you tried the script on complex document ? I have runed my script on my girl friend thesis, and all went well... but there was a 25% increase in size ! The document had styles, footnotes, page numbers, etc...

Files for which the script is very useful had all photos in them. there was a 9 to 1 compression ratio. I do not know what to conclude from this.

Of course i work with "fast save" off, but i have still experienced the problem nevertheless.
The other point of my script is batch treating a lot of stupid files, eg before sending them by email.
Last but not least, if anything goes wrong, the original will be waiting for you in the trash.



[ Reply to This | # ]
An AppleScript to reduce large Word file sizes
Authored by: carsten on May 21, '03 10:48:23PM

A bit of trivia:

The MS Word "Allow fast saves" option was originally designed (and was at one time actually useful) in the days before most computers booted and ran off of hard disks, a time when you had no choice but to save your document to a floppy disk (such as B: on the PC).

The "Allow fast saves" option simply appended the changes since the last save onto the end of the the document without having to rewrite the entire document out to the slow floppy disk, an operation that could take many minutes to complete especially for long documents.

In my personal opinion, only MS would retain such a feature many, many years even after it was no longer required--with hard disks standard on all computers nowadays an extra 0.25 seconds to save a document makes virtually no difference. When working with very, very large documents perhaps it makes a difference during saves, but the speed advantage is lost each time a document is loaded because Word takes slightly longer to *load* a "fast-saved" document.

Turning off "Allow fast saves" in Word has been the only workaround for certain obscure bugs in the Macintosh version of Word in the past (search the Microsoft website for fast save, maybe some of the problems from years ago are still in their' database),so I'm not surprised to hear there are still problems even today when it is turned on.



[ Reply to This | # ]
An AppleScript to reduce large Word file sizes
Authored by: DavidRavenMoon on May 23, '03 10:27:32AM
My wife is a serious Word user... and I had a problem where importing a Word document into InDesign 2.02 showed all the changes to the document, and I needed an easier way to get rid of all that stuff!

She says this is the proper method to use: Go to Tools -> Track Changes -> Accept or Reject Changes. From there you can accept changes and save the document. This removes all the old versions.


[ Reply to This | # ]