http://www.perlmonks.org?node_id=200870


in reply to Perl+MSWord (via Win32::OLE) events handling

Depending on what you want to make it do, it is possible the OLE interface has a method to do it. You can use something like OLESpy, or the OLE/COM Viewer tool that comes with Visual C++ (and i think elsewhere too) to verify. If there is no method, i do not believe there is a was to 'fire' and event, as events are supposed to signal something within the COM Object, and the external execution of that would be, well, icky (Technical Term®).
from the frivolous to the serious

Replies are listed 'Best First'.
Re: Re: Perl+MSWord (via Win32::OLE) events handling
by charnos (Friar) on Sep 26, 2002 at 14:04 UTC
    Have you used the ActiveState OLE Browser? I've had to use Win32::OLE to automate some Word events en masse, but nothing this complicated (plus I cheated..I used a word template file and navigated around it using bookmarks), and when trying to RTFM on my own, I decided to use the browser. I thought it was overall pretty lousy, there was absolutely no documentation for the libraries, just class/method/property names. Are these tools much better? If so, I think it would be very useful to other monks using Win32.

    As for the original question, I'd agree..poke around the OLE library, also perhaps the Win32::API documentation, it would be a whole lot messier, but if you truly, absolutely, positively need it done, it may be the only way.
Re: Re: Perl+MSWord (via Win32::OLE) events handling
by Courage (Parson) on Sep 26, 2002 at 14:48 UTC
    Thank you for help,
    Actually event processing is quite okay in Win32::OLE module, although it is in alpha state. (as perldoc Win32::OLE says), so I was dreaming about a possibility to send not only standard event, but some kind of my own notification.

    One way exists to solve my task for sure, but it is too complicated, and I am afraid of implementing it.
    Idea is to use PerlScript engine from MS-Word to communicate my initial script via, say, "PostThreadMessage" or alike. (PerlScript from ActiveState was mentioned somewhere at this site)
    but I really afraid of such complications: there should be too much conditions to be met in order to run a program, one of them - perl-5.8.0 will not be able to do that currently, as it is not PerlScript-aware, AFAIK.

    Courage, the Cowardly Dog