LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Scripting/Automating Programs (like COM.... :$ ) (http://www.linuxquestions.org/questions/programming-9/scripting-automating-programs-like-com-%24-390187/)

richardh1970 12-07-2005 12:10 PM

Scripting/Automating Programs (like COM.... :$ )
 
I looked for answers to this already - but I couldn't find them. Apologies is this has been asked before...

OK - I'm a Windows programmer at the moment, so I'm used to writing VBA code (Macros) to automate programs like Word, Excel etc 'from the inside' and writing scripts (typically js) to automate them 'from the outside'. So my life is full of things like...

var oExcel;
oExcel = new ActiveXObject("excel.application");
oExcel.Workbooks.Add(...);etc.

How do I use my nice shiny new Linux system to automate OpenOffice, Koffice etc. in a similar way? I've read about StarBasic, so I think I can manage to write macros in that, but those are stored in the document and processed by the application itself. Often it is preferable (or occasionally necessary) to automate from 'outside' the application, such as from script.

I'm happy with any sensible scripting language you suggest - although I must admit at the moment I'm hugely impressed with Python. If need be I can dig out my rusty C++ skills - but surely these things can be scripted?

Cheers,

Richard. :newbie:

Hko 12-08-2005 06:45 AM

Quote:

How do I use my nice shiny new Linux system to automate OpenOffice, Koffice etc. in a similar way? I've read about StarBasic, so I think I can manage to write macros in that, but those are stored in the document and processed by the application itself.
I only know (a little) about OpenOffice.org (OOo) programming. The native language to program using OOo-object is Java (OOo has a Sun history). But the API is also available to C++ and purhaps other langauages. AFAIK you can only use these languages from outside documents. If you want to program macro's that reside inside doc's, you can only use OO-basic.

Quote:

I'm happy with any sensible scripting language you suggest - although I must admit at the moment I'm hugely impressed with Python.
Ah, python! Then the good news is that starting with the rather new OOo version 2.0 has an imbedded python interpreter, so you now can write macros in python instead of OO-basic for use inside doc's. I guess it's also very well possible to use python from outside doc's, but I didn't have a look at it yet.

Some links about OOo-API programming:
http://www.ooomacros.org/dev.php
http://www.pitonyak.org/oo.php
http://wiki.services.openoffice.org/wiki/VBA

Official doc's: http://api.openoffice.org/Developers...persGuide.html

A forum dedicated to OOo-programming:
http://www.oooforum.org/forum/viewforum.phtml?f=9

richardh1970 12-08-2005 08:14 AM

Thanks for the advice, I'll see what I can find.

R.


All times are GMT -5. The time now is 11:31 PM.