Auto-Save Microsoft Word with Keyboard Maestro
In Mac Power Users Episode 187, David Sparks and Katie Floyd talked about word processing apps, which meant talking a great deal about Microsoft Word, as well as Pages and others. Around the 38m40s mark, Katie mentioned that she uses Word a lot in her day job, and has a lot of issues with the app freezing up periodically. That led her to make a comment about intending to write a Keyboard Maestro macro to save every minute when using Microsoft Word.
Having recently finished my D.Min. thesis in Microsoft Word, I already had a macro for that. As I was writing this article, it also occurred to me that I would like to save when Microsoft Word deactivates (is no longer the front-most app).
However, even if you don't use Keyboard Maestro, I encourage you to read on, because I'm going to offer another suggestion at the end.
Auto-Save every X minutes (or seconds)
Microsoft Word does have an auto-recovery setting, but nothing beats the security of manually saving. Unlike modern apps, Microsoft Word does not support the versioning and auto-save features in OS X. Keyboard Maestro can run that save command every X seconds or minutes.
The macro is designed to run only when Microsoft Word is active, and I set mine to run every minute.
However, with Keyboard Maestro I don't have to just blindly save every sixty seconds, I can check specific criteria. I chose two:
The front window of Microsoft Word exists (this means that there is an open document window in Word)
A menu item "Save" is enabled (you'd find it under the "File" menu)
Note that when the "Save As" window is open in Microsoft Word, the "Save" menu is disabled. That is not true in all apps, so if you implement this macro for another app, you may want to check that a button "Save" does not exist.
Here is how those two conditions appear in Keyboard Maestro:
Next we get to the actions section, and I included two here, although many people might choose to delete one of them.
The first is a notification which will appear and inform the user that the macro is running. After awhile, that might get annoying, but I suggest using it until you get used to the idea, as it will help reinforce the fact that the macro is actually running.
The second is the action which actually saves the document. You can do this one of two ways in Keyboard Maestro:
Choose the menu item "Save" under the "File" menu, or
Simulate ⌘ +S
Most times I prefer to have Keyboard Maestro use the file menu, rather than keyboard shortcuts, because it's easier to understand what the macro is doing when I'm reviewing them in Keyboard Maestro. However, ⌘ +S is perfectly clear, and it should prevent the macro from causing any problems if I happen to be typing when it runs. So I recommend having Keyboard Maestro use keyboard shortcuts when it makes sense to do so.
The only downside to this is that if you are navigating through Microsoft Word's menus at the same time that the macro runs, the menu will close, but the same problem will occur if we tell our macro to use the menu item File » Save.
Auto-Save Microsoft Word when you switch to another app
Saving your document while you are using Word is great, but what happens when you switch to another app? If you have been editing that Word document for at least a minute, it should have saved a recent copy, but wouldn't it be great if you could save every time you switched away from Word?
But how? Obviously once we have switched away from Word, pressing ⌘ +S isn't going to save the current word document. Couldn't we tell Keyboard Maestro to use the menu item for Word, even after Word is no longer the front-most app?
I learned this one the hard way with another app. The reason it won't work is obvious once you think about it: you switch away to another app, then Keyboard Maestro switches back to Word to save... then what happens? Well, either a) Keyboard Maestro leaves you in Word, which isn't what you wanted, or b) it switches you to away to another app... which will trigger the Keyboard Maestro macro to run again. We have now discovered something called an infinite loop, and I don't mean the address in Cupertino.
So how can we do this? The answer is AppleScript:
During the Mac Power Users episode, David mentioned several times that Microsoft Office has great AppleScript support, and he even mentioned Ben Waldie whose article is where I found this simple AppleScript command which tells Microsoft Word to save its current document.
This AppleScript command is nearly magic for three reasons:
It does not require Microsoft Word to be active (front-most) in order for it to work, nor does it bring Microsoft Word to the front when it runs.
If there is no active document, the AppleScript command will not cause any noticeable errors: no system beep, nothing.
If you are navigating Word's menus when the AppleScript command is triggered, it will wait until the menu closes before running.
Remember how I said that ⌘ +S had one downside? Well, this AppleScript command doesn't have it.
Remember those conditions that we had to check for ("Does Microsoft Word have an existing front window? Is the 'Save' menu enabled?")?
Now we don't need to worry about any of that. In fact, we no longer need two separate macros, all we need is one macro which will run:
Every minute when Microsoft Word is active
Any time that Microsoft Word deactivates
Since we no longer need to check for any more conditions, all we need is one action, that AppleScript command. So now the whole thing just looks like this:
Of course I added some additional comments and notifications, which you can delete if you don't want them.
To install this: download the macro, double-click on it, and it will be imported into Keyboard Maestro.
As mentioned above, Microsoft Word does not support OS X versions; however, if you save your Word documents to Dropbox it will save all of your changes for 30 days.
Don't want to use Dropbox, but want locally saved versions? Take a look at ForeverSave 2 which not only gives you "versions" (even for apps that don't support OS X's implementation) but also can simulate ⌘ + S every X seconds (which means you wouldn't necessarily even need my Keyboard Maestro macro, although it's a more elegant and complete solution).
There is a free demo version of ForeverSave 2 available, and a license is US$20. I have been using it and think it is quite useful.
Because I had to, that's why. David went to great lengths to say that he doesn't think Word is as bad as its reputation, and a lot of it is leftover anti-Microsoft sentiments or something. I disagree. For a big project, MSWord was a giant PITA. Besides that, even with The Ribbon, by default what you get when you create a new document in Word just looks... gross. The good news is you can make it look much better. ↩
The only change I made was to add the check to see if Word is running, because if you quit Word that counts as deactivation which would trigger the AppleScript which would launch Word. ↩
Subscribe to Newsletter
Software Updatesmore updates
- Dropbox adds file/folder renaming and Office document editing to iOS app
- Vizzywig 8xHD price tag now a very affordable $49.99
- Automatic targets teen drivers with License+ service
- Dropbox adds support for TouchID
- YouTube for iOS gets updated with full support for iPhone 6 and 6 Plus
- iOS 8.0.1 update now available (Updated -- Don't update!)