[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

win32ole question - how to get handle on currently running app?

Its Me

3/11/2006 7:40:00 PM

I need to process a bunch of word files using win32ole.

word = WIN32OLE.new('word.application')

starts a new word application instance each time it executes. Is there a way
to get a hold of the currently running word app, if any?

Thanks.


3 Answers

David Mullet

3/11/2006 7:47:00 PM

0

Use the connect method in place of the new method:

word = WIN32OLE.connect('word.application')


itsme213 wrote:
> I need to process a bunch of word files using win32ole.
>
> word = WIN32OLE.new('word.application')
>
> starts a new word application instance each time it executes. Is there a way
> to get a hold of the currently running word app, if any?
>
> Thanks.

chiaro scuro

3/14/2006 12:19:00 PM

0

How would you choose between a number of different running instances of an
application?

On 3/11/06, david.mullet@gmail.com <david.mullet@gmail.com> wrote:
>
> Use the connect method in place of the new method:
>
> word = WIN32OLE.connect('word.application')
>
>
> itsme213 wrote:
> > I need to process a bunch of word files using win32ole.
> >
> > word = WIN32OLE.new('word.application')
> >
> > starts a new word application instance each time it executes. Is there a
> way
> > to get a hold of the currently running word app, if any?
> >
> > Thanks.
>

David Mullet

3/14/2006 1:42:00 PM

0

You could use the WIN32OLE.connect method with the path and filename of
the open document in place of the ProgID:

xlWorkbook = WIN32OLE.connect('c:\SomeFolder\SomeFile.xls')

I have only tested this with Excel, but it should also work to obtain a
Word document object.

Mully