[Pythonmac-SIG] Controlling Word from Python on OS X

Tim Jarman tim.jarman at lineone.net
Tue Mar 2 13:43:00 EST 2004


On Tuesday 02 Mar 2004 6:10 pm, Paul Berkowitz wrote:
> On 3/2/04 9:49 AM, "Tim Jarman" <tim.jarman at lineone.net> wrote:
> > I assume this can be done, but am not sure how best to go about it.
> > Specifically, I am trying to automate a mailmerge. Can anyone point me in
> > the right direction? MSDN is being its usual 'helpful' self. I'm assuming
> > the answer is going to involve AppleEvents but haven't a clue where to
> > start.
> >
> > (I have done this before under Windows using DDE... God, I feel old...)
>
> AppleScripting Word has not worked properly since v5.1 - when it was very
> simple. And MailMerge (Data Merge) did not really exist in Word Mac until
> Word X. What works for Word - almost always - is to use the AppleScript 'do
> Visual Basic' command with VBA. However, since the Data Merge Manager in
> Word X is Mac-only, I'm not 100% positive that it can be done in Word X.

I had a horrible feeling this might be the case.

> Perhaps so. I created an elaborate set of scripts for Office 2001,
> AppleScripting Entourage 2001 to do just about everything that MailMerge
> was supposed to do but didn't (in 2001 - works just fine in Word X).
> They're called "Office for Office" and you can get them at
>
>  MacScripter.net   <http://macscripter.net/scriptbuilders/>
>
> But it would be too laborious to convert such large scripts over. You'll
> also need to wait for has's AppScript. By that time, Word 2004 will be out,
> and you'll find some changes which might be very helpful.
>

Sadly, I don't have that long. Thanks for the pointer though.

> In the meantime, you might have to forget Python and just write a VBA macro
> and/or translate it to AppleScript via 'do Visual Basic'.

Visual Basic. Oh joy. Well, it's still got to be easier than writing my own 
mail-merge functionality.

Thanks for your prompt help -- the Python community never ceases to amaze me!

Tim J




More information about the Pythonmac-SIG mailing list