Page 1 of 1
How to use COM in OO?
Posted: Mon Aug 18, 2008 1:59 pm
by grnhorn
Does anyone have an example of using COM in OO? I found 1 link to tcom, but that is not part of OO or Star BASIC.
Thanks...
Re: How to use COM in OO?
Posted: Tue Aug 19, 2008 1:23 pm
by B Marcelly
Hi,
Try this link :
VBx OOo tools
______
Bernard
Re: How to use COM in OO?
Posted: Tue Aug 19, 2008 3:12 pm
by grnhorn
Thanks Bernard. I will have to spend some time on this. Apparently OO does not have a way of connecting to documents that are not exposed like VBA has. I have tried using DDE and whatever, but it has all failed. I am wondering if OO is going to correct this issue??? DDE is no longer supported by MS and it started failing years ago. I do some PLC work and a connection is required for data gathering. If OO doesn't do something, they are going to lose ground that they have gained.
I will get back in a few days.
Re: How to use COM in OO?
Posted: Tue Aug 19, 2008 8:30 pm
by B Marcelly
Hi,
grnhorn wrote:Apparently OO does not have a way of connecting to documents that are not exposed like VBA has.
I'm not sure to understand what you mean.
If you mean load a document in hidden mode and handle it, of course that's possible with COM.
If you mean embedding OOo in a frame of another application, I have never succeeded in doing this. Perhaps others have.
I am not aware of any OOo development in the works to improve COM.
______
Bernard
Re: How to use COM in OO?
Posted: Tue Aug 19, 2008 8:53 pm
by grnhorn
I meant to say that OO does not have a way to link to hidden documents using OO BASIC. OO apparently needs an interface like VBA to communicate with its own documents. What I am seeing, if I am correct, OO does not have any COM capabilities because it does not support object creation (Set OpenOffice = CreateObject("com.sun.star.ServiceManager"). I also assume that StarBasic does not support COM????
I am new at OO and have a long ways to go.
Re: How to use COM in OO?
Posted: Tue Aug 19, 2008 9:27 pm
by ms777
grnhorn,
I am also not completely sure what you are targeting at, but constructions like this work perfectly fine in OO Basic:
Code: Select all
Sub Main
oleService = createUnoService("com.sun.star.bridge.OleObjectFactory")
oIE = oleService.createInstance("InternetExplorer.Application")
oIE.visible = true
oIE.Navigate("http://somehwhere/")
while oIE.Busy
wait(50)
wend
oDoc = oIE.Document
oInputs = oDoc.getElementsByTagName("INPUT")
oInputPass= oInputs.item(0)
msgbox "Now it will submit ..."
oInputPass.click
End Sub
Re: How to use COM in OO?
Posted: Tue Aug 19, 2008 9:44 pm
by grnhorn
My actual target is sCalc in that I want to be able to manipulate the data in 1 sheet from 2 different sources while the target is not visible and accessible to the user.
I took a look at your example and I guess I am a little more confused by the following 2 examples:
Code: Select all
oInputs = oDoc.getElementsByTagName("INPUT")
oInputPass.click
I used xRay and 'getElementsByTagName' did not show up for oDoc and 'click' did not show up for 'oInputPass'. Where did you get these from? Also, I could not find a method for closing IE.
Thanks for your help...