I need a macro that
count the how many times a text sequence like "[number]" apears inside on a doc
sum all the numbers inside the brackets
generate a doc with proprieties of the file like date, filename, how many ocurrences and the sum of the numbers..
can anyone help me on this?
Rictec
I need a design macro can anyone help
Re: I need a design macro can anyone help
The purpose of this forum is not to write complete macros for people, but to help with issues or "how-to". For the help you require, I would suggest that either you try by yourself and ask questions when you are blocked, or you ask a forum administrator to move your thread to the section "Paid support".
LibreOffice 4.2.3.3. on Ubuntu 14.04
Re: I need a design macro can anyone help
thank you for your input...as you saying unless i paid no one is going to help me on this?
i don t think that paying someone to do it helps, cos i was after learning how to do it on write basic or even if something like this is possible on write.
Maybe someone else helps me untill then i have some reading to do
Rictec
i don t think that paying someone to do it helps, cos i was after learning how to do it on write basic or even if something like this is possible on write.
Maybe someone else helps me untill then i have some reading to do

Rictec
Re: I need a design macro can anyone help
First read OOo wiki Basic Programming Guide.
Second useful Andrew Pitonyak macro information.
Third Sun documentation.
Usable examples on OOo macros.
Second useful Andrew Pitonyak macro information.
Third Sun documentation.
Usable examples on OOo macros.
AOO 4.0 and LibO 4 on Win 8
Hungarian forum co-admin
Hungarian forum co-admin
Re: I need a design macro can anyone help
thanks that was helpfull i m reading Andrew docs now
Re: I need a design macro can anyone help
From your description I would estimate that "the real one and only IT professional" would never waste hours of time to write an office macro for this trivial task. You could save the document as plain text and let a tiny script do the job (should be doable with a single command in the Perl programming language).
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: I need a design macro can anyone help
Thats an ideia and a very good one i will check that possibility still i need to learn how that can be done with a macro
Thank you
Thank you
Re: I need a design macro can anyone help
Sigh, I did it again!
Save with UNIX line feeds as <ooo_profile>/user/Scripts/python/sum_num.py
Activate your text document and call
Menu:Tools>Macros>Organize>Python... sum_num > sum_num [Run]
Code: Select all
import uno, sre
from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK
def sum_num():
thisComponent = XSCRIPTCONTEXT.getDocument()
oText = thisComponent.getText()
oCursor = oText.createTextCursor()
txt = oText.getString()
regex = '\[([0-9]+)\]'
oPattern = sre.compile(regex)
aMatches = sre.findall(oPattern, txt)
result = 0
for m in aMatches:
result += int(m)
oCursor.gotoEnd( False )
oText.insertControlCharacter( oCursor, PARAGRAPH_BREAK, False )
oText.insertString( oCursor, 'SUM: '+ unicode(result), False )
g_exportedScripts = sum_num,
Activate your text document and call
Menu:Tools>Macros>Organize>Python... sum_num > sum_num [Run]
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice