OO Writer Macros Usage

Creating a macro - Writing a Script - Using the API

OO Writer Macros Usage

Postby Cliff S » Wed Oct 30, 2019 6:18 pm

Is there a way to combine or merge OO writer macros to work as one macro? I have a large group of documents that I wish to modify either in full or in parts. For example I have a different macro to Boldface text, change a font, delete a Date. I would like to run them as one macro. I am unable to find a capability to edit a macro.
Last edited by MrProgrammer on Wed Oct 30, 2019 7:21 pm, edited 1 time in total.
Reason: Moved from Beginners forum to Macros and UNO API
Open Office 4.1.1 on Windows 10
Cliff S
 
Posts: 36
Joined: Mon Sep 07, 2015 2:54 am

Re: OO Writer Macros Usage

Postby RoryOF » Wed Oct 30, 2019 6:42 pm

You can Copy/Paste all your macros into a plain text editor, one after the other, then Copy/Paste the amalgamation back into the OO macro editor and add any extra code you need.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29863
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: OO Writer Macros Usage

Postby Zizi64 » Wed Oct 30, 2019 7:18 pm

Please upload the parts of the macro code here.
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.3.3; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8517
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: OO Writer Macros Usage

Postby JeJe » Wed Oct 30, 2019 10:21 pm

Write a macro that calls the other macros

Code: Select all   Expand viewCollapse view
sub runMacros1to3()
macro1
macro2
macro3
end sub
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 624
Joined: Wed Mar 09, 2016 2:40 pm

Re: OO Writer Macros Usage

Postby RoryOF » Wed Oct 30, 2019 10:24 pm

@JeJe: Wouldn't they all need to be in the same library? That is why I suggested amalgamating them into the one unit, which leaves the individual macros functional in their files, in case that is ever needed.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29863
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: OO Writer Macros Usage

Postby JeJe » Wed Oct 30, 2019 10:47 pm

Wouldn't they all need to be in the same library?


I'm not sure if that's a response to my post... but if the macros are in different documents then yes you may need to put them somewhere like the My Macros / Standard Library: you can't call a macro in one document from another document.

(If the macro is already in My Macros/some-library-name - then so long as the other library is loaded you can call the macro in it)
Last edited by JeJe on Wed Oct 30, 2019 10:53 pm, edited 3 times in total.
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 624
Joined: Wed Mar 09, 2016 2:40 pm

Re: OO Writer Macros Usage

Postby RoryOF » Wed Oct 30, 2019 10:49 pm

I edited my post to make it clear it was a reply to your post, JeJe.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29863
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: OO Writer Macros Usage

Postby DiGro » Thu Oct 31, 2019 3:43 pm

I did the same with some macros of mine

I subsequently ran the macros be calling them from the previous executed one.

So macro 1 calls macro2, then macro2 calls macro3 etc...

Call the next macro just before closing the executed one, something like:
Code: Select all   Expand viewCollapse view
previous executed code.....

Call SubMacro2()

End Sub


You can edit macros by using Tools > Macros > Manage Macros > OpenOffice Basic.
That will bring you to the Basic IDE where you can make en edit macro's
____________
DiGro

AOO 4.1.7 on Windows 10. Scanned with ZIGGO Safe Online (F-Secure)
User avatar
DiGro
 
Posts: 82
Joined: Mon Oct 08, 2007 1:31 am
Location: Hoorn NH, The Netherlands

Re: OO Writer Macros Usage

Postby Cliff S » Thu Oct 31, 2019 11:04 pm

Hi RoryOF At this point I believe that you had the best solution offered. Unfortunately I can't actually test it as another problem has occurred preventing testing it. The macro record function has ceased working. When I try and record a new macro it is no longer saving it. When I click save it appears to work and gives no error message or code. When I try to run that macro it does not appear in any of the folders. I'm going to have to solve this problem first. Also I checked the macro security function and found its set to medium. Tnx
Open Office 4.1.1 on Windows 10
Cliff S
 
Posts: 36
Joined: Mon Sep 07, 2015 2:54 am

Re: OO Writer Macros Usage

Postby RoryOF » Thu Oct 31, 2019 11:19 pm

The OO Macro recorder is rudimentary; a recorded macro will often need to be hand edited to put the detailed functionality into it from the OO API information or the OO BASIC manual.

A quick search suggests that the macro recording functionality is only available for text documents in OOo Writer and for spreadsheets in OOo Calc. I cannot say how accurate this information is.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29863
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland


Return to Macros and UNO API

Who is online

Users browsing this forum: RPG and 7 guests