Pannello di Controllo Moderatore ]

Ripetere macro in Writer

Discussioni sull'applicazione di videoscrittura

Ripetere macro in Writer

Messaggioda pignapao » martedì 24 gennaio 2017, 14:25

Ciao a tutti,
ho creato una macro per cambiare il formato di una lista di sottotitoli e vorrei che si ripetesse fino a fine documento.
Quale codice devo inserire e, soprattutto, dove?

Questa è la macro

Codice: Seleziona tutto   Espandi visualeStringi visuale
REM  *****  BASIC  *****

Sub Main
End Sub


sub Sottotitoli1
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Count"
args1(0).Value = 1
args1(1).Name = "Select"
args1(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args1())

rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Count"
args2(0).Value = 1
args2(1).Name = "Select"
args2(1).Value = true

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args2())

rem ----------------------------------------------------------------------
dim args3(1) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Count"
args3(0).Value = 1
args3(1).Name = "Select"
args3(1).Value = true

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args3())

rem ----------------------------------------------------------------------
dim args4(1) as new com.sun.star.beans.PropertyValue
args4(0).Name = "Count"
args4(0).Value = 1
args4(1).Name = "Select"
args4(1).Value = true

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args4())

rem ----------------------------------------------------------------------
dim args5(1) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Count"
args5(0).Value = 1
args5(1).Name = "Select"
args5(1).Value = true

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args5())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())

rem ----------------------------------------------------------------------
dim args7(1) as new com.sun.star.beans.PropertyValue
args7(0).Name = "Count"
args7(0).Value = 1
args7(1).Name = "Select"
args7(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args7())

rem ----------------------------------------------------------------------
dim args8(1) as new com.sun.star.beans.PropertyValue
args8(0).Name = "Count"
args8(0).Value = 1
args8(1).Name = "Select"
args8(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args8())

rem ----------------------------------------------------------------------
dim args9(1) as new com.sun.star.beans.PropertyValue
args9(0).Name = "Count"
args9(0).Value = 1
args9(1).Name = "Select"
args9(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args9())

rem ----------------------------------------------------------------------
dim args10(1) as new com.sun.star.beans.PropertyValue
args10(0).Name = "Count"
args10(0).Value = 1
args10(1).Name = "Select"
args10(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args10())

rem ----------------------------------------------------------------------
dim args11(1) as new com.sun.star.beans.PropertyValue
args11(0).Name = "Count"
args11(0).Value = 1
args11(1).Name = "Select"
args11(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args11())

rem ----------------------------------------------------------------------
dim args12(1) as new com.sun.star.beans.PropertyValue
args12(0).Name = "Count"
args12(0).Value = 1
args12(1).Name = "Select"
args12(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args12())

rem ----------------------------------------------------------------------
dim args13(1) as new com.sun.star.beans.PropertyValue
args13(0).Name = "Count"
args13(0).Value = 1
args13(1).Name = "Select"
args13(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args13())

rem ----------------------------------------------------------------------
dim args14(1) as new com.sun.star.beans.PropertyValue
args14(0).Name = "Count"
args14(0).Value = 1
args14(1).Name = "Select"
args14(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args14())

rem ----------------------------------------------------------------------
dim args15(1) as new com.sun.star.beans.PropertyValue
args15(0).Name = "Count"
args15(0).Value = 1
args15(1).Name = "Select"
args15(1).Value = true

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args15())

rem ----------------------------------------------------------------------
dim args16(0) as new com.sun.star.beans.PropertyValue
args16(0).Name = "Text"
args16(0).Value = ","

dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args16())

rem ----------------------------------------------------------------------
dim args17(1) as new com.sun.star.beans.PropertyValue
args17(0).Name = "Count"
args17(0).Value = 1
args17(1).Name = "Select"
args17(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args17())

rem ----------------------------------------------------------------------
dim args18(1) as new com.sun.star.beans.PropertyValue
args18(0).Name = "Count"
args18(0).Value = 1
args18(1).Name = "Select"
args18(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args18())

rem ----------------------------------------------------------------------
dim args19(0) as new com.sun.star.beans.PropertyValue
args19(0).Name = "Text"
args19(0).Value = "0"

dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args19())

rem ----------------------------------------------------------------------
dim args20(1) as new com.sun.star.beans.PropertyValue
args20(0).Name = "Count"
args20(0).Value = 1
args20(1).Name = "Select"
args20(1).Value = true

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args20())

rem ----------------------------------------------------------------------
dim args21(0) as new com.sun.star.beans.PropertyValue
args21(0).Name = "Text"
args21(0).Value = " --> "

dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args21())

rem ----------------------------------------------------------------------
dim args22(1) as new com.sun.star.beans.PropertyValue
args22(0).Name = "Count"
args22(0).Value = 1
args22(1).Name = "Select"
args22(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args22())

rem ----------------------------------------------------------------------
dim args23(1) as new com.sun.star.beans.PropertyValue
args23(0).Name = "Count"
args23(0).Value = 1
args23(1).Name = "Select"
args23(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args23())

rem ----------------------------------------------------------------------
dim args24(1) as new com.sun.star.beans.PropertyValue
args24(0).Name = "Count"
args24(0).Value = 1
args24(1).Name = "Select"
args24(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args24())

rem ----------------------------------------------------------------------
dim args25(1) as new com.sun.star.beans.PropertyValue
args25(0).Name = "Count"
args25(0).Value = 1
args25(1).Name = "Select"
args25(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args25())

rem ----------------------------------------------------------------------
dim args26(1) as new com.sun.star.beans.PropertyValue
args26(0).Name = "Count"
args26(0).Value = 1
args26(1).Name = "Select"
args26(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args26())

rem ----------------------------------------------------------------------
dim args27(1) as new com.sun.star.beans.PropertyValue
args27(0).Name = "Count"
args27(0).Value = 1
args27(1).Name = "Select"
args27(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args27())

rem ----------------------------------------------------------------------
dim args28(1) as new com.sun.star.beans.PropertyValue
args28(0).Name = "Count"
args28(0).Value = 1
args28(1).Name = "Select"
args28(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args28())

rem ----------------------------------------------------------------------
dim args29(1) as new com.sun.star.beans.PropertyValue
args29(0).Name = "Count"
args29(0).Value = 1
args29(1).Name = "Select"
args29(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args29())

rem ----------------------------------------------------------------------
dim args30(1) as new com.sun.star.beans.PropertyValue
args30(0).Name = "Count"
args30(0).Value = 1
args30(1).Name = "Select"
args30(1).Value = true

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args30())

rem ----------------------------------------------------------------------
dim args31(0) as new com.sun.star.beans.PropertyValue
args31(0).Name = "Text"
args31(0).Value = ","

dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args31())

rem ----------------------------------------------------------------------
dim args32(1) as new com.sun.star.beans.PropertyValue
args32(0).Name = "Count"
args32(0).Value = 1
args32(1).Name = "Select"
args32(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args32())

rem ----------------------------------------------------------------------
dim args33(1) as new com.sun.star.beans.PropertyValue
args33(0).Name = "Count"
args33(0).Value = 1
args33(1).Name = "Select"
args33(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args33())

rem ----------------------------------------------------------------------
dim args34(0) as new com.sun.star.beans.PropertyValue
args34(0).Name = "Text"
args34(0).Value = "0"

dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args34())

rem ----------------------------------------------------------------------
dim args35(1) as new com.sun.star.beans.PropertyValue
args35(0).Name = "Count"
args35(0).Value = 1
args35(1).Name = "Select"
args35(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args35())

rem ----------------------------------------------------------------------
dim args36(1) as new com.sun.star.beans.PropertyValue
args36(0).Name = "Count"
args36(0).Value = 1
args36(1).Name = "Select"
args36(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args36())

rem ----------------------------------------------------------------------
dim args37(0) as new com.sun.star.beans.PropertyValue
args37(0).Name = "Text"
args37(0).Value = " "

dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args37())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SwBackspace", "", 0, Array())

rem ----------------------------------------------------------------------
dim args39(1) as new com.sun.star.beans.PropertyValue
args39(0).Name = "Count"
args39(0).Value = 1
args39(1).Name = "Select"
args39(1).Value = false

dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args39())

end sub

 Editato: codice macro "codificato" (admin) 
Open Office 4.1.3
Mac OsX 10.11.6
pignapao
 
Messaggi: 2
Iscritto il: martedì 24 gennaio 2017, 14:04

Re: Ripetere macro in Writer

Messaggioda Gaetanopr » martedì 24 gennaio 2017, 15:35

Puoi allegare un esempio?
Ciao
Openoffice 4.1 su windows xp
Gaetanopr
Volontario
Volontario
 
Messaggi: 2845
Iscritto il: mercoledì 21 novembre 2012, 21:07

Re: Ripetere macro in Writer

Messaggioda pignapao » mercoledì 25 gennaio 2017, 12:12

La macro compie questa trasformazione

9 : 01:01:14:15 01:01:16:15
Show us your stuff!

9
01:01:14,150 --> 01:01:16,150
Show us your stuff!
Open Office 4.1.3
Mac OsX 10.11.6
pignapao
 
Messaggi: 2
Iscritto il: martedì 24 gennaio 2017, 14:04

Re: Ripetere macro in Writer

Messaggioda Gaetanopr » mercoledì 25 gennaio 2017, 17:53

Ti avevo chiesto un esempi sul quale provare, quindi una pagina con il formato iniziale e un'altra con il formato desiderato, oppure due files prima e dopo.
Openoffice 4.1 su windows xp
Gaetanopr
Volontario
Volontario
 
Messaggi: 2845
Iscritto il: mercoledì 21 novembre 2012, 21:07


Torna a Writer

Chi c’è in linea

Visitano il forum: Nessuno e 11 ospiti