Win32OLE and remote servers?

R

rubyhacker

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
 
C

Corey Lawson

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
 
S

Shashank Date

Hi Hal,

--- [email protected] said:
I'm rying to figure out whether it's possible to
talk to the COM interface of a program running
on a remote machine.
=20
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 neve=
r used it before but here
is a good starting point:

http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dndcom=
/html/msdn_dcomhb.asp
Thanks for any info...
=20
=20
Cheers,
Hal

-- shanko

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

rubyhacker

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
 
S

Shashank Date

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 :)
=20
To talk to a local COM-aware app, there's no reason Win32OLE
shouldn;t suffice, is there?=20

Depends on the app ... rather the documentation (or the lack thereof) tha=
t 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


=09
____________________________________________________
Sell on Yahoo! Auctions =96 no fees. Bid on great items. =20
http://auctions.yahoo.com/
 
S

Shashank Date

Hi Daz,

Sorry, I missed your post.=20

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

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

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

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

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

excel.DisplayAlerts =3D false
excel.ActiveWorkbook.Save
excel.Workbooks.Close
excel.DisplayAlerts =3D 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 `ex=
cel.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
=20
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=20
http://mail.yahoo.com=20
 
S

Shashank Date

Hi,

--- Shashank Date said:
=20
I have tried the trick mentioned in that post but could not get it to w= ork.
=20

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

http://support.microsoft.com/kb/q158582/

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top