Beginner Macro Tutorial.....

Creating a macro - Writing a Script - Using the API

Beginner Macro Tutorial.....

Postby scott1x » Fri Jun 13, 2008 6:59 pm

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
OOo 3.2.1 on Ms Windows XP
scott1x
 
Posts: 28
Joined: Thu Jun 05, 2008 4:19 am

Re: Beginner Macro Tutorial.....

Postby TerryE » Tue Jun 17, 2008 6:27 pm

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 [i]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 :-)
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.
TerryE
 
Posts: 1402
Joined: Sat Oct 06, 2007 10:13 pm
Location: UK

Re: Beginner Macro Tutorial.....

Postby scott1x » Tue Jun 17, 2008 6:43 pm

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.
scott1x
 
Posts: 28
Joined: Thu Jun 05, 2008 4:19 am

Re: Beginner Macro Tutorial.....

Postby Villeroy » Wed Jun 18, 2008 7:07 am

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
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 12.04, Apache OpenOffice 4.x
User avatar
Villeroy
Volunteer
 
Posts: 17320
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 6 guests