After a power shortage with OO documents (saved as .odt) opened or maybe after a Win7 update,
2 macros in OO writer are not working anymore.
I read some posts so I could locate my 2 macros in C:\Users\MAX\AppData\Roaming\OpenOffice\4\user\basic\Standard .
They are still there, just not working anymore, so I'm gonna provide you further details.
OS: windows 7
OpenOffice 4.1.7
Macros relate to : OO Writer
Macros are not anymore present under Tools > Macro. I think I checked correctly any sub directory.
(this meaning I cannot run the macro manually, navigating under the directories) .
Shortcuts assigned : F4 and F8 . Hitting them return this error code : https://imgur.com/hqcyZff
PREMACRO is the first macro and it was assigned to F4, KEYWORDS is the second one, assigned to F8.
They were running smoothly before.
Finally: the code has been someway been edited and I cannot fix it.
I went on a working copy of the macro and tried to edit the first error I could understand, which was : " was expressed as plain text .
I fixed it with a find and replace , that worked but the next error was something like CTIL expected and here I am.
Let me know and I'd be glad to provide whatever detail I can.
Cheers !
I cannot attach XBA and XLB neither relative txt files so I paste here the code so you can have a look at the macros.
We're talking about a couple formatting macros : PREMACRO and CAPSBOLD + 1 that searches some 10-15 keywords in a given text: KEYWORDS.
Only PREMACRO and KEYWORDS were assigned a special key to recall them.
THere's also a macro called DELETE and that has not to be considered.
**************************************************************************
FILE A: TRANSCRIPT.xba (main file)
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="TRANSCRIPT" script:language="StarBasic">sub KEYWORDS()
oDoc = ThisComponent
oBank = Array("interesting", "possibility", "obvious", "quality", "because", "why", "false", "trap", "window", "five-minute", "news", "short seller", "short sellers", "squeeze", "squeezes", "halt", "halts", "short", "share seller", "sellers", "000 share", "the ask", "the bid", "bids", "hitting", "cover", "spread", "hidden", "borrow", "level two", "tape", "level too", "level 2", "pattern", "setup ", "strategy", "pivot", "citron", "hedge fund", "filing", "secondary", "small cap", "moving average", "tesla", "ipob", "hyln", "mike")
for i =0 to ubound(obank) 'prepare regex string
if i<>0 then st = st & "|"
st = st & "\b" & obank(i) & "\b"
next
oDesc = oDoc.createSearchDescriptor()
odesc.SearchRegularExpression = true
odesc.searchstring = st
oFound = oDoc.findAll(oDesc)
If oFound.Count > 0 Then
For i = 0 to oFound.Count -1
oInstance = oFound.getByIndex(i)
oInstance.CharColor = RGB(255 ,0, 0)
next i
End If
End Sub
sub PREMACRO
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 ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
rem ----------------------------------------------------------------------
dim args2(18) as new com.sun.star.beans.PropertyValue
args2(0).Name = "SearchItem.StyleFamily"
args2(0).Value = 2
args2(1).Name = "SearchItem.CellType"
args2(1).Value = 0
args2(2).Name = "SearchItem.RowDirection"
args2(2).Value = true
args2(3).Name = "SearchItem.AllTables"
args2(3).Value = false
args2(4).Name = "SearchItem.Backward"
args2(4).Value = false
args2(5).Name = "SearchItem.Pattern"
args2(5).Value = false
args2(6).Name = "SearchItem.Content"
args2(6).Value = false
args2(7).Name = "SearchItem.AsianOptions"
args2(7).Value = false
args2(8).Name = "SearchItem.AlgorithmType"
args2(8).Value = 1
args2(9).Name = "SearchItem.SearchFlags"
args2(9).Value = 65536
args2(10).Name = "SearchItem.SearchString"
args2(10).Value = "$"
args2(11).Name = "SearchItem.ReplaceString"
args2(11).Value = " "
args2(12).Name = "SearchItem.Locale"
args2(12).Value = 255
args2(13).Name = "SearchItem.ChangedChars"
args2(13).Value = 2
args2(14).Name = "SearchItem.DeletedChars"
args2(14).Value = 2
args2(15).Name = "SearchItem.InsertedChars"
args2(15).Value = 2
args2(16).Name = "SearchItem.TransliterateFlags"
args2(16).Value = 1280
args2(17).Name = "SearchItem.Command"
args2(17).Value = 3
args2(18).Name = "Quiet"
args2(18).Value = true
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args2())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:ResetAttributes", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageUp", "", 0, Array())
end sub
sub CAPSBOLD
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 ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:ChangeCaseToUpper", "", 0, Array())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Bold"
args2(0).Value = true
dispatcher.executeDispatch(document, ".uno:Bold", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(2) as new com.sun.star.beans.PropertyValue
args3(0).Name = "FontHeight.Height"
args3(0).Value = 9
args3(1).Name = "FontHeight.Prop"
args3(1).Value = 100
args3(2).Name = "FontHeight.Diff"
args3(2).Value = 0
dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args3())
rem ----------------------------------------------------------------------
dim args4(2) as new com.sun.star.beans.PropertyValue
args4(0).Name = "FontHeight.Height"
args4(0).Value = 10
args4(1).Name = "FontHeight.Prop"
args4(1).Value = 100
args4(2).Name = "FontHeight.Diff"
args4(2).Value = 0
dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args4())
end sub
sub DELETE
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 ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:ChangeCaseToUpper", "", 0, Array())
end sub
</script:module>
FILE B : AltSearchBatchs.xba
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="AltSearchBatchs" script:language="StarBasic">REM ***** BASIC *****
Option Explicit
' Warning this module is modified by execution of AltSearch macro!
' Contains subroutines for assign key shortcut for AltSearch's batchs.
' Do not change any character unless you know what you do!
Sub Altsearch___dialog
On Error resume next
GlobalScope.BasicLibraries.LoadLibrary("AltSearch") 'load AltSearch library
_AltSearch
End sub
Sub Altsearch___Find_next
On Error resume next
GlobalScope.BasicLibraries.LoadLibrary("AltSearch")
_FindNext
End sub
Sub Altsearch___Find_previous
On Error resume next
GlobalScope.BasicLibraries.LoadLibrary("AltSearch")
_FindBack
End sub
</script:module>FILE C: script.xlb
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false"/>FILE D: dialog.xlb (the last one in the directory)
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false"/>