Page 1 of 1

Beginner Macro Tutorial.....

Posted: Fri Jun 13, 2008 6:59 pm
by scott1x
I am not a whiz or object oriented programmer, but I just went through the process of trying to get a macro up and running in open office calc and my experiences may help you. Check out the wiki for more detail:
http://en.wikipedia.org/wiki/Object-ori ... rogramming

That should confuse you! To help clarify matters, I've documented my first macro experience. Since it is up and running, my efforts may aid yours.... Rather than clutter up the forum, here's a link to what I found.

http://catfangz.com/OOMacro.html

Re: Beginner Macro Tutorial.....

Posted: Tue Jun 17, 2008 6:27 pm
by TerryE
Object Oriented Basic is a bit of an oxymoron isn't it :-)

The UNO API and the many services that are provided to support access to OOo documents are reasonably Object oriented, but the OOo Basic is certainly not. Just go through the article that you reference and ask yourself how many of these concepts are supported by Basic and the answer is almost none (try extending an UNO class for example).

What Basic does do is to provide a simple abstraction interface over UNO so you don't have to worry about Interfaces and that you can treat the interface methods and properties as belonging directly to the object. It also does some nice tricks such as mapping the getXXX and set XXX methods onto pseudo properties. It also bares a superficial resemblance to VBA. Apart from that the implementation (I've been through most of the code) is terrible[/b] and contains many architectural flaws.

Python is a far more sound basis (and supports proper object orientation by the way). The only thing that it really lacks as a macro language for executing in-process is a decent IDE. Having one would be a great enhancement to OOo.

But don't let me put you off. Keep up the good work and I look forward to your first Python post :-)

Re: Beginner Macro Tutorial.....

Posted: Tue Jun 17, 2008 6:43 pm
by scott1x
I have NO argument with anything you say!. The fact is, I'd never heard of python until I started looking at the macro facility of calc! As it happens, I know basic, and for quick and dirty, it gets projects up and running. It seem that the implementation of python macros required a lot more work than basic, and for the simple task I had, I didn't want to invest the time.

HOWEVER, having said that.... Could you recommend some basic reading on python? I am interested in learning.

Scott ;)

PS, Don't do VBA, either. I come from a mainframe environment.

Re: Beginner Macro Tutorial.....

Posted: Wed Jun 18, 2008 7:07 am
by Villeroy
HOWEVER, having said that.... Could you recommend some basic reading on python? I am interested in learning.
http://www.ibiblio.org/swaroopch/byteof ... files/120/
Having some programming exprerience and a decent code editor, a free weekend should suffice. The interpreter (v2.3) comes with a standard installation of OpenOffice.org as <OOo_install>/program/python[.exe]

As always, things become complicated when OOo comes into play: http://udk.openoffice.org/python/python-bridge.html