Randall Parker wrote:
> 
> I've written a script (simpler version of it below) that can start MS Word and even 
>tell Word to open various
> documents. But when the Perl Script exits then Word exits too.
> 
> I'm looking for some way around this. Does anyone know how can one do one or more of 
>these possible
> solutions?

Reading the the perldocs on Win32::OLE I find that it suggests that for
the new() method that the string

   'Quit'

is a destructor which runs when the perl script exits.

Removing it from the new() on my computer means word does not exit when
perl exits.

> 
> 1) Keep Word open when the Perl script exits? Is there some way to say to start Word 
>but not as a
> subprocess of the Perl Process? 
> 2) Have the Perl script block at its end waiting for Word to exit?
> 
> 3) Have the Perl script check to see if Word is already running and if it is then 
>create an OLE connection
> to the existing Word process rather than create a new Word process?

Are you saying the script you have opens a new word window?  What
version of Word are you using?  Word 2000 creates a new process window
for each document.  Could that be what you are seeing?

(If someone know a way to stop Word 2000 from opening a process window
for each doc, regardless of perl, I would like to see it.)

> 
> use strict;
> use Win32::OLE;
> use Win32::OLE::Const 'Microsoft Word';
> use File::Find;
> use File::Basename; # for parsing pathnames.
> use Cwd;
> 
>    our $AWord;
> 
> {
>    my $rootdir;
> 
>    $rootdir = cwd;
>    print "Root Dir: $rootdir\n";
> 
>    our $AWord = Win32::OLE->new('Word.Application', 'Quit');
>    our $AWord->{'Visible'} = 1;         # if you want to see what's going on
> 
> }
>
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to