I am running (walking?):

Windows 95b (4.00.950 B)
Internet Explorer (aka OS extension) 5.01 sp1 (5.00.3105.0106)
ActiveState Perl binary 522  (Perl 5.005_03) with ActiveState PPM-supplied
extensions
Microsoft Word 97 SR-2

I am editing in TextPad (www.textpad.com) 4.4.1 and have configured an
option under its Tools menuto  shell out and run the current script within
said shell.  Specifically, it fires up command.com and passes it "c:
\perl\bin\perl.exe $File" where file is the current file (the script) in
the editor.

Well, I just tried my example Word scriptlet straight from the command line
of a DOS window, and it did both open a new instance and exit while the
instance was still up.  So it is the editor's tool that is not displaying a
completed message until the instance of Word exits.  Perhaps the editor's
tool tracks spawned processes as well as the original process.  My mistake
-- sorry for the confusion.  I should have caught this myself.

That leaves the difference between Word 97 SR-2 and Excel 97 SR-2 as to
where "$<program>->{Visible} = -1;" leaves the application's window in the
GUI window stack.  I'm not too worried about that.  :-)

What I described isn't really an issue for me, as I never programmatically
interface with Word.  However, the issue did come up in the process of
developing my response to the original question, and I find it interesting.
Unfortunately, I don't know enough to have the appropriate insights.






To:   [EMAIL PROTECTED]
cc:   [EMAIL PROTECTED]
Subject:  Re: How to start Word and keep it running?


[EMAIL PROTECTED] wrote:
>
> Using Win95b, Word 97 sp2, AS Perl 5.005_03
>
> Ok, I modified my suggestion below to work with Word.  It works; however,
> if it starts a new instance of Word, the script will not exit until that
> instance is terminated.  (Note that script statements after the
invocation
> of Word appear to execute in parallel, but the script's process will not
> terminate until that instance of Word is killed.)  This differs from
Excel,
> where the instance will live on without locking up the script's process.
> Further, if Word already has an instance, the script will exit; however,
> the $word->{Visible} = -1; assignment will not leave the instance's
Window
> on top after exit.  Again, this differs from Excel.  Anyone have
> explanations on these points?
>
> Guess I need to get one of David Roth's books.
>
> Here's the transmogrified code:
>
> #!c:/perl/bin/perl
>
> # Reference existing Word instance or start a new one.  Die on failure of
both attempts.
> use Win32::OLE qw(in with);
> use Win32::OLE::Const 'Microsoft Word';
> $Win32::OLE::Warn = 3;                                          # die on
errors...
> my $word = Win32::OLE->GetActiveObject('Word.Application')
>     || Win32::OLE->new('Word.Application');                     # get
already active Word
>                                                                 #
application or open new
> # Make the Word session visible.
> $word->{Visible} = -1;
>

I am using

   win 98
   perl 5.6.0

and running from the command line the script always exits.

What OS/perl are you using?  How are you running it?




_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to