Auto-Save Microsoft Word

ms_word

#1

Awhile ago I wrote an article on TUAW (now Engadget) about auto-saving in Microsoft Word.

This was mentioned in Mac Power Users #279 but unfortunately the download links for the macro are broken because I am the literal worst about keeping things online.

(Yet another reason I am glad this forum exists, it's a better place to post my macros.)

You can go read the original article if you want, but here’s the nut of how it works:

Create a Keyboard Maestro macro which is triggered every X minute(s) (I suggest X = 1) and when Microsoft Word deactivates, have the Keyboard Maestro macro run this AppleScript:

tell application "Microsoft Word"
	if it is running then
		save active document
	end if
end tell

If you want to get a little more fancy, you can avoid some edge cases for annoyances by using this instead:

tell application "Microsoft Word"
	if running then
		if documents is not missing value then
			tell active document
				if (not saved and path contains ":") then save
			end tell
		end if
	end if
end tell

That will avoid some errors if the document hasn’t been saved yet or if there is no actual open document in MSWord.

Disclaimer: I’m no AppleScript expert, I just cobbled this together from examples I found around the web. Use at your own risk, etc.

I also made another little macro that will prompt me whenever MSWord activates and the current document is Not Saved. It just displays a notification, but that’s usually enough to get my attention.

You can get the fancy version of the Auto-Save macro and the notification macro here:

Auto-Save MSWord.kmmacros (6.4 KB)


#2

Thanks, I was looking for this after listening to that MPU episode yesterday.


#3

These do not work for me. Word 2011, Mac El Capitan. Returns a dialog "Word cannot fire event"
Any helpful hints?


#4

I have no idea why it would say that. Perhaps Peter would be able to help.

Sorry I can’t be more useful.


#5

No idea, maybe it needs a more recent version of Word?


#6

No, I use it with Office 2011.


#7

Hey Burk,

Well, that doesn’t make much sense…

Try this AppleScript:

tell application id "com.microsoft.Word"
  if it is running then
    if documents is not missing value then
      tell active document
        if (not saved and path contains ":") then save
      end tell
    end if
  end if
end tell

Run it first from the Script Editor.app to exclude any issues introduces by Keyboard Maestro.

If it works there then move on to Keyboard Maestro.

-Chris


#8

A web search returned this result:

http://www.tech-archive.net/Archive/Mac/microsoft.public.mac.office.word/2005-07/msg00549.html

"Yep. To confirm, removing Acrobat Reader, and reinstalling it, solved this
problem for me. Only difference is that we were getting the error when
closing a document, rather than opening them.”

I do not have Acrobat Reader installed, which might explain why I have not
seen this.

TJ Luoma
TJ @ MacStories http://www.macstories.net/author/tjluoma/
Personal Website: luo.ma http://luo.ma/ (aka RhymesWithDiploma.com
http://rhymeswithdiploma.com/)
Twitter: @tjluoma http://twitter.com/tjluoma