[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Win32OLE and remote servers?

rubyhacker

7/7/2005 9:12:00 PM

I'm rying to figure out whether it's possible to
talk to the COM interface of a program running
on a remote machine.

I thought this was impossible, but someone suggested
it might be possible.

Thanks for any info...


Cheers,
Hal

7 Answers

Corey Lawson

7/7/2005 9:39:00 PM

0

You might be able to via the WMI interfaces. Look up some VBScript +
WMI code via Google (or on MSDN), and that would be a good start.

By default, most/all of the WMI methods work on a local instance,
unless given a \\remotecomputer name.

Of course, this is also assuming you have the right privileges (i.e.,
domain administrator).

-Corey

On 7/7/05, rubyhacker@gmail.com <rubyhacker@gmail.com> wrote:
> I'm rying to figure out whether it's possible to
> talk to the COM interface of a program running
> on a remote machine.
>
> I thought this was impossible, but someone suggested
> it might be possible.
>
> Thanks for any info...
>
>
> Cheers,
> Hal
>
>
>


Shashank Date

7/7/2005 9:41:00 PM

0

Hi Hal,

--- rubyhacker@gmail.com wrote:

> I'm rying to figure out whether it's possible to
> talk to the COM interface of a program running
> on a remote machine.
>
> I thought this was impossible, but someone suggested
> it might be possible.

I believe it is possible by virtue of DCOM (Distributed COM). I have never used it before but here
is a good starting point:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndcom/html/msdn_...

> Thanks for any info...
>
>
> Cheers,
> Hal

-- shanko

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail...


rubyhacker

7/7/2005 10:30:00 PM

0

Thanks, Corey and Shashank...

It sounds like my first impulse might well be the easiest one --
to wrap a COM server with Ruby and then share it remotely
using drb.

To talk to a local COM-aware app, there's no reason Win32OLE
shouldn;t suffice, is there? Ralph Mason had a thing called
RubyCOM -- I used to know the difference, but I've forgotten.


Cheers,
Hal

daz

7/7/2005 11:53:00 PM

0


Hal wrote:
> I'm rying to figure out whether it's possible to
> talk to the COM interface of a program running
> on a remote machine.
>
> I thought this was impossible, but someone suggested
> it might be possible.
>
> Thanks for any info...
>


"Hello! Can you help me?"
http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/36595?36502-38858+split-mod...

?

daz


Shashank Date

7/8/2005 1:24:00 AM

0

Hal,

> It sounds like my first impulse might well be the easiest one --
> to wrap a COM server with Ruby and then share it remotely
> using drb.

Correct ... that would be my impulse too :-)

> To talk to a local COM-aware app, there's no reason Win32OLE
> shouldn;t suffice, is there?

Depends on the app ... rather the documentation (or the lack thereof) that comes with it.
But yes, in general there is no reason that Win32OLE shouldn't suffice.

Which COM aware app(s) are we talking of here?
-- shanko



____________________________________________________
Sell on Yahoo! Auctions ? no fees. Bid on great items.
http://auctions....


Shashank Date

7/8/2005 4:08:00 PM

0

Hi Daz,

Sorry, I missed your post.

--- daz <dooby@d10.karoo.co.uk> wrote:
>
> "Hello! Can you help me?"
>
http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/36595?36502-38858+split-mod...
>

I have tried the trick mentioned in that post but could not get it to work.
Here is the segment I tried:

#####################
require 'win32ole'

excel = WIN32OLE.new("excel.application",'localhost') # 'wsdev01')
excel['Visible'] = true
spreadsheet = excel.Workbooks.Open("C:\\junk.xls")
sheet = spreadsheet.Worksheets(1).Range("D1")
excel.Columns("A:A").select
excel.Sheets(1).Range("D1")

excel.Selection.Font.Name = "Arial"
excel.Selection.Font.FontStyle = "Normal"
excel.Selection.Font.Size = 14

excel.DisplayAlerts = false
excel.ActiveWorkbook.Save
excel.Workbooks.Close
excel.DisplayAlerts = true
#############################################

When I ran it with 'localhost' it ran fine. But when I changed it to
'wsdev01' which is a machine on the network which my machine can see
and has Excel installed on it, the script error'd out saying:

C:/atest/tst_excel.rb:6:in `initialize': Failed to create DCOM server `excel.application' in
`wsdev01' (WIN32OLERuntimeError)
HRESULT error code:0x80070005
Access is denied. from C:/atest/tst_excel.rb:6:in `new'
from C:/atest/tst_excel.rb:6

Any hints as to what I could be doing wrong?
Thanks,
-- shanko


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail...


Shashank Date

7/8/2005 5:34:00 PM

0


Hi,

--- Shashank Date <shanko_date@yahoo.com> wrote:

>
> I have tried the trick mentioned in that post but could not get it to work.
>

Ok, I take that back. I found this KB article on

http://support.microsoft.com/k...

and when I set up the client and the server properly using DCOMCNFG.exe, I was able to run the
script (without the Save).

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail...