REM ***** BASIC *****
sub Vloz_vysvetl
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 i%,sVar%,prv%,psv%,cv$
prv = InputBox ("Od verše:","Zadat počáteční číslo verše")
psv = InputBox ("Do verše:","Zadat konečné číslo verše")
sVar = MsgBox("Od verše: "+prv+" do verše: "+psv,128 + 3,"Kontrola počtu veršů v Hlavě")
i = prv
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args101(0) as new com.sun.star.beans.PropertyValue
args101(0).Name = "FootnoteAnchorText"
args101(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args101())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args102(0) as new com.sun.star.beans.PropertyValue
args102(0).Name = "FootnoteAnchorText"
args102(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args102())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args103(0) as new com.sun.star.beans.PropertyValue
args103(0).Name = "FootnoteAnchorText"
args103(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args103())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args104(0) as new com.sun.star.beans.PropertyValue
args104(0).Name = "FootnoteAnchorText"
args104(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args104())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args105(0) as new com.sun.star.beans.PropertyValue
args105(0).Name = "FootnoteAnchorText"
args105(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args105())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args106(0) as new com.sun.star.beans.PropertyValue
args106(0).Name = "FootnoteAnchorText"
args106(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args106())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args107(0) as new com.sun.star.beans.PropertyValue
args107(0).Name = "FootnoteAnchorText"
args107(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args107())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args108(0) as new com.sun.star.beans.PropertyValue
args108(0).Name = "FootnoteAnchorText"
args108(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args108())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args109(0) as new com.sun.star.beans.PropertyValue
args109(0).Name = "FootnoteAnchorText"
args109(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args109())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args110(0) as new com.sun.star.beans.PropertyValue
args110(0).Name = "FootnoteAnchorText"
args110(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args110())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args111(0) as new com.sun.star.beans.PropertyValue
args111(0).Name = "FootnoteAnchorText"
args111(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args111())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args112(0) as new com.sun.star.beans.PropertyValue
args112(0).Name = "FootnoteAnchorText"
args112(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args112())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args113(0) as new com.sun.star.beans.PropertyValue
args113(0).Name = "FootnoteAnchorText"
args113(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args113())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args114(0) as new com.sun.star.beans.PropertyValue
args114(0).Name = "FootnoteAnchorText"
args114(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args114())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args115(0) as new com.sun.star.beans.PropertyValue
args115(0).Name = "FootnoteAnchorText"
args115(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args115())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args116(0) as new com.sun.star.beans.PropertyValue
args116(0).Name = "FootnoteAnchorText"
args116(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args116())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args117(0) as new com.sun.star.beans.PropertyValue
args117(0).Name = "FootnoteAnchorText"
args117(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args117())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args118(0) as new com.sun.star.beans.PropertyValue
args118(0).Name = "FootnoteAnchorText"
args118(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args118())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args119(0) as new com.sun.star.beans.PropertyValue
args119(0).Name = "FootnoteAnchorText"
args119(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args119())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args120(0) as new com.sun.star.beans.PropertyValue
args120(0).Name = "FootnoteAnchorText"
args120(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args120())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args121(0) as new com.sun.star.beans.PropertyValue
args121(0).Name = "FootnoteAnchorText"
args121(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args121())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args122(0) as new com.sun.star.beans.PropertyValue
args122(0).Name = "FootnoteAnchorText"
args122(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args122())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args123(0) as new com.sun.star.beans.PropertyValue
args123(0).Name = "FootnoteAnchorText"
args123(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args123())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args124(0) as new com.sun.star.beans.PropertyValue
args124(0).Name = "FootnoteAnchorText"
args124(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args124())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
rem ----------------------------------------------------------------------
dim args125(0) as new com.sun.star.beans.PropertyValue
args125(0).Name = "FootnoteAnchorText"
args125(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args125())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args126(0) as new com.sun.star.beans.PropertyValue
args126(0).Name = "FootnoteAnchorText"
args126(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args126())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args127(0) as new com.sun.star.beans.PropertyValue
args127(0).Name = "FootnoteAnchorText"
args127(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args127())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args128(0) as new com.sun.star.beans.PropertyValue
args128(0).Name = "FootnoteAnchorText"
args128(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args128())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args129(0) as new com.sun.star.beans.PropertyValue
args129(0).Name = "FootnoteAnchorText"
args129(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args129())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args130(0) as new com.sun.star.beans.PropertyValue
args130(0).Name = "FootnoteAnchorText"
args130(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args130())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
IF i >= psv Then GoTo Konec
i = i + 1
cv = i
Search(dispatcher,document)
rem ----------------------------------------------------------------------
dim args131(0) as new com.sun.star.beans.PropertyValue
args131(0).Name = "FootnoteAnchorText"
args131(0).Value = cv
dispatcher.executeDispatch(document, ".uno:InsertEndnote", "", 0, args131())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
Konec:
end sub
Function Search(dispatcher,document)
rem dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(21) as new com.sun.star.beans.PropertyValue
args1(0).Name = "SearchItem.StyleFamily"
args1(0).Value = 2
args1(1).Name = "SearchItem.CellType"
args1(1).Value = 0
args1(2).Name = "SearchItem.RowDirection"
args1(2).Value = true
args1(3).Name = "SearchItem.AllTables"
args1(3).Value = false
args1(4).Name = "SearchItem.SearchFiltered"
args1(4).Value = false
args1(5).Name = "SearchItem.Backward"
args1(5).Value = false
args1(6).Name = "SearchItem.Pattern"
args1(6).Value = false
args1(7).Name = "SearchItem.Content"
args1(7).Value = false
args1(8).Name = "SearchItem.AsianOptions"
args1(8).Value = false
args1(9).Name = "SearchItem.AlgorithmType"
args1(9).Value = 1
args1(10).Name = "SearchItem.SearchFlags"
args1(10).Value = 65536
args1(11).Name = "SearchItem.SearchString"
args1(11).Value = "( )[:digit:]{1,}( )"
args1(12).Name = "SearchItem.ReplaceString"
args1(12).Value = ""
args1(13).Name = "SearchItem.Locale"
args1(13).Value = 255
args1(14).Name = "SearchItem.ChangedChars"
args1(14).Value = 2
args1(15).Name = "SearchItem.DeletedChars"
args1(15).Value = 2
args1(16).Name = "SearchItem.InsertedChars"
args1(16).Value = 2
args1(17).Name = "SearchItem.TransliterateFlags"
args1(17).Value = 1073743104
args1(18).Name = "SearchItem.Command"
args1(18).Value = 0
args1(19).Name = "SearchItem.SearchFormatted"
args1(19).Value = false
args1(20).Name = "SearchItem.AlgorithmType2"
args1(20).Value = 2
args1(21).Name = "Quiet"
args1(21).Value = true
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())
End Function
Připadá mi to strašně krkolomné, ale funguje to. Doufám, že až se v Basicu trochu zorientuji, tak to udělám "hezčí". Zatím vůbec netuším co znamenají různě číslované args(x).
K hledání čísel: požívám regulární výraz [:digit:]{1,}, který hledá jedno a vícečíselná čísla.
Neutr: Děkuji vám za trpělivost a za každou pomoc jsem moc vděčný, i když leckdy Váš příspěvek úplně nepochopím, doufám, že zatím .