[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Check for Open Application

Not Thisguy

6/1/2008 3:06:00 PM

Hello,

I am trying to write a simple script and all I need to do is check if
there is all ready a running instance of the word application. I look
and couldn't find much on google how to do this...which probably means
it's really easy, so I'm sorry for this post but I'm still learning :)

Thanks in advance for your help!


koooee
--
Posted via http://www.ruby-....

4 Answers

Tobias Weber

6/1/2008 3:15:00 PM

0

In article <9e5b09fa795c251950ba3bc19dc04d34@ruby-forum.com>,
Not Thisguy <nickkolegraf@hotmail.com> wrote:

> there is all ready a running instance of the word application. I look

Microsoft Word?

> and couldn't find much on google how to do this...which probably means

Which OS?
On the Mac you can use Apple Events or NSWorkspace through various
bridges.

--
Tobias Weber

Not Thisguy

6/1/2008 3:30:00 PM

0

Tobias Weber wrote:
> In article <9e5b09fa795c251950ba3bc19dc04d34@ruby-forum.com>,
> Not Thisguy <nickkolegraf@hotmail.com> wrote:
>
>> there is all ready a running instance of the word application. I look
>
> Microsoft Word?

Yes Microsfot Word


>> and couldn't find much on google how to do this...which probably means
>
> Which OS?
> On the Mac you can use Apple Events or NSWorkspace through various
> bridges.


Windows Vista is the OS.


Thanks for the interest!

koooee
--
Posted via http://www.ruby-....

David Mullet

6/1/2008 4:14:00 PM

0

Not Thisguy wrote:
> Hello,
>
> I am trying to write a simple script and all I need to do is check if
> there is all ready a running instance of the word application. I look
> and couldn't find much on google how to do this...which probably means
> it's really easy, so I'm sorry for this post but I'm still learning :)
>
> Thanks in advance for your help!
>
>
> koooee

One option is to try to connect to a running instance of Word. If there
is no running instance of Word, a WIN32OLERuntimeError exception will be
raised. So you could do the following:

require 'win32ole'

begin
word = WIN32OLE.connect('Word.Application')
rescue WIN32OLERuntimeError
word = WIN32OLE.new('Word.Application')
word.Visible = true
end

David

http://rubyonwindows.bl...
http://rubyonwindows.bl.../search/label/word
--
Posted via http://www.ruby-....

Not Thisguy

6/1/2008 5:26:00 PM

0

David Mullet wrote:
> One option is to try to connect to a running instance of Word. If there
> is no running instance of Word, a WIN32OLERuntimeError exception will be
> raised. So you could do the following:
>
> require 'win32ole'
>
> begin
> word = WIN32OLE.connect('Word.Application')
> rescue WIN32OLERuntimeError
> word = WIN32OLE.new('Word.Application')
> word.Visible = true
> end
>
> David
>
> http://rubyonwindows.bl...
> http://rubyonwindows.bl.../search/label/word


Awsome thank you so much!!
--
Posted via http://www.ruby-....