SPUG: Minimal Perl web site & notification requests

Tim Maher tim at consultix-inc.com
Fri Jun 17 10:22:55 PDT 2005

On Fri, Jun 17, 2005 at 09:08:29AM -0700, Uri London wrote:
> Bill Campbell mentioned a friend of him was 6 (six!!!) times
> more productive than her colleagues just by using vi! Are you
> claiming that given everything else is equal, vi would be 6
> times faster than ms-word?

As a touch typist, it's a /lot/ faster for me to type
I<italicized> in vim (which is POD markup), than to type
"italicized" in Word, then grab the mouse, highlight the word,
and click the [I] button to italicize it. Multiply that effort
differential by a gajillion times or so, for a book of 400+ pages,
and you'll understand why I chose not to write my manuscript in Word.

Also, I can use grep, sed, and Perl to massage the text, and do
mass substitutions using regular expressions that are much more
sophisticated than what Word's "find/replace" facility provides.
> Second, many people complain about the "primitive" Microsoft macro.
> This is weird claim given the richness of Office Automation. You can
> basically control every aspect of Word from virtually any other
> language.

That's an apples retort to an oranges gripe.

Macros are accessible even to the most Bozoid user (although IMHO
they can't be trusted to function properly). Win32::OLE, on the
other hand, is a big obstacle even to long-time programmers like
me, because when I read the documentation all I hear about are
wacky things like "apartment models", and I have no idea how to
do what I want with it.

For example, to italicize all the comments in my code samples, I
need to search for a "#" in style3 that's either at the beginning
of a line or at the start of a new word (but not in quotes), and
convert all the characters from the # to the end of the line to
italic. (Those comments were of course marked as italic when I
imported them into Word from HTML, but the italicization gets
lost somewhere along the way.)

> I've never written Office automation before in my life, yet I
> was able to open the online help, and in 5 minutes came up with quick (6
> lines) Perl scripts that demonstrate how Office can be automated using a
> Perl script. 

I'd very much like to learn how to use this technology from Perl, if
it can really help me. Is there a decent tutorial somewhere?
> 	use Win32::OLE;
> 	my $app = Win32::OLE->new('Word.Application');
> 	$app->{Visible} = 1;
> 	$app->Documents->Add( );
> 	my $sel = $app->Selection;
> 	$sel->TypeText( 'Hello Word' );

This example seems to just be assembling a Word doc. I need to
know what facilities there are for /manipulating existing docs/.
> And Office 2003 has excellent, extensively document, XML support. Give
> it a try.

> u.

Really? I bought it on the understanding that Word docs would be
/saved/ in XML, so that I could easily massage the raw data. But
the storage format is still some inscrutable proprietary format,
AFAIK. If XML is really in there somewhere, how do you get at it?

| Tim Maher, PhD     (206) 781-UNIX      (866) DOC-PERL     (866) DOC-UNIX |
| tim(AT)Consultix-Inc.Com  http://TeachMePerl.Com  http://TeachMeUnix.Com |
|   Watch for my Summer, 2005 book: "Minimal Perl for UNIX/Linux People"   |
|  See http://manning.com/Maher for details, and email notification signup |

More information about the spug-list mailing list