Tools/Customize/Menus/Category/Macros crashes

Trying to trigger custom macros from menu items, not keystrokes and not custom UI buttons in sheets. Using a toolbar button would be fine too.

Using version 6.4.6.2 64b on Win 8.1 with Java runtime not installed (installing didn’t fix).

Tools → Customize → Menus tab → Category dropdown → select Macros Boom! LO crashes. Same with
Tools → Customize → Toolbars tab → Category dropdown → select Macros Boom! LO crashes. Same with
Tools → Customize → Context Menus tab → Category dropdown → select Macros Boom! LO crashes.

Installed version 7.1.4.0 and the same crash still happened.
Reverted to 6.4.6.2 and installed Java and the same crash still happened.

What should I do to diagnose and fix this?

Based on the description, LO crashes while building a list of available commands. At this point, all application libraries (LibreOffice Macros and My Macros) and document libraries are scanned.
Try to temporarily remove all libraries except LibreOffice Macros and then add one library at a time until the error appears.

This was the clue. Temporarily removed all custom basic code-files from their folder. LO started showing an error message before quitting, like:
pythonscript: storage uri 'whatever' not in base uri 'whatever'
Then used websearch, and searched the program folder for the source of that message, which is in “…\LibreOffice\6.4.6.2\Program\pythonscript.py” at line 204. The code compares two strings, and crashes with a Runtime Exception when they are not the same. Trouble is, the strings were the same, except for uppercase versus lowercase. They happened to be names of folders. That means LO could not reasonably handle the situation where someone changes the case of some folder names behind its back. That’s not good. Anyway, updated the code to ignore case like:
if not storageURI.lower().startswith('self.m_baseUri.lower() ):
Now, the folder names can be cased however I like, and LO doesn’t care. Now I can assign a new button or new menu item to fire off Basic code for updating document content. Thanks to sokol92 for the clue.

IHMO thats not a solution but makes the situation even worse??
AFAIK pythonscript exclusivly manages python-code from different locations related to python …/Scripts/python/…

It would be best if you created a bug report with clear repro steps.

2 Likes

What should I do to diagnose and fix
this?

The Macro Recorder is not an efficient tool. It works in the Witer and the Calc applications only.

You need write your macros instead of recording them, if you want to work efficiently with the macros in the LibreOffice. You need to study and use the API functions. API: Application Programmning Interface.

And I suggest you to install one of the excellent trird party Object inspection tools like the MRI or the XrayTool. then you will able to examine the properties and methods of the programming objects.

Thanks that background info may help in the long run.

By “custom” I was trying to specify ‘hand-coded’ and not ‘recorded’. My only use for recording macros is to discover how the UI links up with the API. Once a macro is recorded, I take it apart and incorporate its API calls into other custom hand-coded macros, then delete the recorded. Links: MRI and XRay