How to use COM in OO?

Creating a macro - Writing a Script - Using the API

How to use COM in OO?

Postby grnhorn » Mon Aug 18, 2008 1:59 pm

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...
OOo 2.4.X on Ms Windows XP
grnhorn
 
Posts: 32
Joined: Sun Jul 13, 2008 2:07 pm

Re: How to use COM in OO?

Postby B Marcelly » Tue Aug 19, 2008 1:23 pm

Hi,
Try this link : VBx OOo tools
______
Bernard
Last edited by B Marcelly on Tue Feb 15, 2011 12:42 pm, edited 1 time in total.
B Marcelly
Volunteer
 
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: How to use COM in OO?

Postby grnhorn » Tue Aug 19, 2008 3:12 pm

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.
OOo 2.4.X on Ms Windows XP
grnhorn
 
Posts: 32
Joined: Sun Jul 13, 2008 2:07 pm

Re: How to use COM in OO?

Postby B Marcelly » Tue Aug 19, 2008 8:30 pm

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
B Marcelly
Volunteer
 
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: How to use COM in OO?

Postby grnhorn » Tue Aug 19, 2008 8:53 pm

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.
OOo 2.4.X on Ms Windows XP
grnhorn
 
Posts: 32
Joined: Sun Jul 13, 2008 2:07 pm

Re: How to use COM in OO?

Postby ms777 » Tue Aug 19, 2008 9:27 pm

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   Expand viewCollapse view
  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
ms777
Volunteer
 
Posts: 131
Joined: Mon Oct 08, 2007 1:33 am

Re: How to use COM in OO?

Postby grnhorn » Tue Aug 19, 2008 9:44 pm

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   Expand viewCollapse view
  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...
OOo 2.4.X on Ms Windows XP
grnhorn
 
Posts: 32
Joined: Sun Jul 13, 2008 2:07 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests