Macros... Not a Newbie... Need Documentaion

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Rattyboy
Posts: 5
Joined: Sat Jun 28, 2008 8:37 pm

Macros... Not a Newbie... Need Documentaion

Post by Rattyboy »

Welcome beginner. Please answer all of the questions below which may provide information necessary to answer your question.
-----------------------------------------------------------------------------------------------------------
Which version of OpenOffice.org are you using?
2.4.x

What Operating System (version) are you using?
Vista

What is your question or comment?

I SWEAR I have looked for the answer to this everywhere. I need to simply change the font with a macro bound to a keystroke. I would like to hit CTRL+T and have the font switch from Times New Roman to Courrier OR, if I am currently using Courrier, switch to Times New Roman. Sort of like font toggle.

All I need to know is how to retrieve the current font in a macro. THen, I can construct the if statements to handle it.

All of the Documentation that I have found spends 5-10 pages on where to store your macros and 5-10 lines on how to actually code a hello world macro. I just can't seem to locate a document that has a list of functions that I can use. For instance, how to retrieve the name of the current document? The last save time of the current doc? Currentworking directory? Current font? etc.

Help? Please? I write LOTS of technical documentation and switching fonts with the mouse ruins my rhythm. :)
OOo 2.4.X on Linux-Other
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macros... Not a Newbie... Need Documentaion

Post by Villeroy »

OpenOffice is based on styles. Simply learn about styles, use styles and assign shortcuts to styles.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
TheGurkha
Volunteer
Posts: 6482
Joined: Thu Mar 13, 2008 12:13 pm
Location: North Wales, UK.

Re: Macros... Not a Newbie... Need Documentaion

Post by TheGurkha »

There's a special Macro sub-forum.

Macro and UNO API

Someone there would be able to tell you what docs are available.

But as Villeroy says, all you need to do is learn about styles. Define your fonts as styles and attach your styles to shortcuts if you want to use them from the keyboard.

Styles are a lot more flexible than direct formatting. For example if you decide to have something (say) source code in your document represented by a certain font, in a particular font size and also in italics, you could have all that applied in one step by applying a single style. And better yet, if you are near the end of a big doc and then someone tells you that the standard for representing source code has changed and must now be in a new font and no italics, you just change the style once and then all of the places in the doc based on that style change as well.
Ubuntu 14.10 Utopic Unicorn, LibreOffice Version: 4.3.3.2
Gurkha Welfare Trust
User avatar
ccornell
Volunteer
Posts: 611
Joined: Sun Oct 07, 2007 7:21 am

Re: Macros... Not a Newbie... Need Documentaion

Post by ccornell »

OOoBasic is well documented... press F1 and look in the application help for Runtime Library.

The OOo Basic guide is on the Wiki and supplements the application help:
http://wiki.services.openoffice.org/wik ... ASIC_Guide
openSUSE 11.4, KDE4.6 with OpenOffice.org 3.3
Rattyboy
Posts: 5
Joined: Sat Jun 28, 2008 8:37 pm

Re: Macros... Not a Newbie... Need Documentaion

Post by Rattyboy »

Many thanks for the pointers!

I'll give those locations a shot. But first I'll try the styles approach. That seems the easiest method.
OOo 2.4.X on Linux-Other
User avatar
TheGurkha
Volunteer
Posts: 6482
Joined: Thu Mar 13, 2008 12:13 pm
Location: North Wales, UK.

Re: Macros... Not a Newbie... Need Documentaion

Post by TheGurkha »

Rattyboy wrote:I'll give those locations a shot. But first I'll try the styles approach. That seems the easiest method.
By far the easiest! If you get stuck, post back here.
Ubuntu 14.10 Utopic Unicorn, LibreOffice Version: 4.3.3.2
Gurkha Welfare Trust
Post Reply