Revisiting Microsoft Word


I have not always been kind to Microsoft Word on the Mac. Put simply, Office 2004, was a slug on intel Macs. It was slow to load, slow to type, and clunky. It was also a resource hog since its not inconsiderable code had to be ground through Rosetta. I simply found it easier to use other applications.

It has occurred to me recently that this has changed. I've been using Office 2008 for a few months and have found it serves an important role in my day job once again. A lot of the work I do is collaborative. I write agreements and contracts all the time and, sadly, I can count the number of Macs on the other end of that process on one hand. So it is a given that I'm dealing with Microsoft Word on the other side of the table just about every time.

Word 2008 cures a lot of its predecessor's sins. It loads pretty snappy and doesn't get in your way when typing. I think the Microsoft Mac:BU has also made some significant strides in making it feel . . . well . . . more Mac-like. I met several of the Office developers at Macworld and a lot of those guys really "get it" with the Mac experience. For me, it was real eye opening. Microsoft Word is legendary for having every imaginable feature. The Microsoft Mac engineers had to retain all of that stuff and still make a pleasant to use Mac application. That is not exactly easy. Nevertheless, they did a good job of containing it all.

Most importantly for me however is compatibility. Microsoft Word on the Mac is rock-solid compatible with that "other operating system." I can send complicated pleadings and forms and nobody ever knows they were made on my Mac. While Pages can do the same for simple documents, on more complex documents, things break down.*

Another thing I like about Word is the way it has embraced automation. Built in automator scripts and plenty of Applescript support make Word an attractive option for me on a lot of my transactional forms. I already blogged this once but plan on following up on this in the future.

So without really thinking about it, I've found myself going directly to Microsoft Word increasingly often. Put simply, Word is back on the team.

* This doesn't mean Pages is out of the rotation. It also certainly doesn't mean that I've stopped using my "precious" Scrivener. When it comes to detailed research or long documents, you'd have to pry Scrivener off my my cold, dead hard drive.

AppleScript for Creating Form Documents in Word 2008


Okay gang, put on your propeller beanie caps. This one is going to be complicated.

One of the things I do during the day job includes a lot of corporate transactional work. As a result I have a few forms that I find myself using repeatedly. For instance, sometimes I have a client that needs a set of corporate minutes. I would like to have a system where I can run a program that prompts me for certain bits of information (i.e. date, corporate officers and directors) and then goes off and opens the form and fills in the basic information for me.

You think there would be guides all over the InterWeb for this but I couldn't find any. So I spent a few hours today learning to Applescript and came up with the script I'm reporting below. I'm no expert at this and I'm pretty sure this could get better but at least my script is functional and hopefully saves the next person from the trouble of starting from scratch.

So I'm going to list the whole script below and then I'm going to break it into pieces. So lets start with the whole script ...


-- Dialog Box to Get Information
set response to display dialog "Type in the name you want to paste" default answer "Thelonious Monk"
set name to text returned of response

tell application "Microsoft Word"
open "Macintosh HD:Users:david:Library:Application Support:Microsoft:Office:User
Templates:My Templates:Piano Legends.dot"
-- Name
set selFind to find object of selection
tell selFind
set content to "**Name**"
set content of replacement of selFind to name
execute find replace replace all
end tell

end tell

So breaking it down let me explain as best as my tiny programming brain can. If you are a complete Applescript newbie you need to first open Script Editor which can be found in the Applescript subdirectory of you Applications folder and then copy the above script in.

-- Dialog Box to Get Information

The two dashes make this line a remark so the program basically ignores it. This sample has only one variable but the actual script has twelve variables. I named each with a remark so I can get back to where I need easily to debug if necessary.

set response1 to display dialog "Type in the name you want to paste" default answer "Thelonious Monk"

This line does two things:

First it pops up a dialog box that says "Type in the name you want to paste"

Second it fills in the box with a default answer of "Thelonious Monk" (Has anyone figured out yet what a big Monk fan I am?)

set name to text returned of response

This was the line that vexxed me the most. Simply putting up the dialog box does not create a variable that can be used to fill in a Word form. This line of code creates a new variable called "name" and fixes the problem. It took me an hour to figure this out.

tell application "Microsoft Word"

Now we are getting to the good stuff. Applescript just opened Word 2008.

open "Macintosh HD:Users:david:Library:Application Support:Microsoft:Office:User Templates:My Templates:Piano Legends.dot"

If you are going to be creating forms you first need to create a template in word. In this example I've created a template (.dot extension) in word called "Piano Legends.dot". Obviously the location of your document template may vary slightly. When you create the template it is important that you distinguish the phrases you plan on replacing. I did it with asterisks. For instance the name section of the document is written "**Name**". In setting it up this way you don't need to bother Applescripting the formatting because the script just uses whatever formatting you chose in the template (i.e. All Caps, bold, etc...)

-- Name

Another comment telling me I'm about to do the find and replace on the Name variable.

set selFind to find object of selection

I'm a bit clueless on this line but the script fails if it is not there. I think it selects the entire document for the find/replace action.

tell selFind
set content to "**Name**"

This starts up the find and replace process. It also sets the variable "content" to the search text I placed in the template as explained above, "**Name**"

set content of replacement of selFind to name

I just told Word "Find every instance of "**Name**" and replace it with the variable "Name"

execute find replace replace all

Word knows what I want it to do. Now it has to go do it.

end tell

Closing the loop.

end tell

Closing the loop again.

So there you have it. A rather tame Applescript that helps automate document production. You can duplicate as many variables and replacements as you need. I'm surprised about how easy this was to figure out considering I'm not much of a code jockey but it sure is handy.

Microsoft Word 2008 - Initial Impressions

Office 2008.jpg

So I've been complaining about Microsoft Word 2004 for some time now. It is sort of a love tolerate/hate relationship that goes back years. I know some people love it but I'm more of a Scrivener and Pages kinda guy myself. This doesn't change the fact that my law office runs on Microsoft Word and we have some fairly complex document formatting. Pages is great for general Word compatability but is not up to scratch for some of the more complex stuff I seem to bang into.

Using Scrivener and exporting text files for my office staff has generally worked out pretty good. A few months ago I had decided I probably wouldn't bother with Office 2008. A few things changed that. First, on black Friday, Microsoft had a great deal that gave a $100 rebate on any copy of Office 2004 purchased that day along with a free upgrade to 2008. So I got in for a very reasonable price. Second, I was at David Pogue's session at Macworld when he interviewed the chief Office 2008 Microsoft honcho. Imagine a room of about 1,000 Mac geeks and in walks a Microsoft executive. Talk about a hostile environment! The guy (I've been trying to find his name but can't so I'll just call him "the guy") was actually very friendly and passionate about the Office 2008. I had to hand it to him for just showing up.

Anyway, I've now been using Word 2008 for three days and these initial impressions are just that ... initial impressions.

1. Word 2008 Runs Faster.

Word 2004 was dog slow on my Intel Mac. It was slow to load and (if this makes any sense) text input. There was a delay between my typing the letter and it appearing.

2. Word 2008 is More Mac Friendly.

I don't know how to put this but it feels more like a Mac application than Word 2004. The inspectors are cleaner and the general look is much improved.

3. Word 2008 is very Compatible with PC Word.

This has always been true but thankfully all of the complex formatting still works. It seems to be even better on some accounts which (I believe) is related to fonts but it is too early to say.

I'll keep you posted as I dig a bit deeper.

-----------Post Update -------

"The Guy", Craig Eisler, was kind enough to write in on the comments. Craig, along with the improved Word 2008, is really doing a good job of smashing up a lot of my bias against Microsoft.