Make folder / path in open dialogs the folder / path of current document?

the situation is plane simple
I use current LO versions (archlinux repositories)

I open a document by using a filemanager (select, right-click, open with LO)…
I want to open another document in the same folder, so I select file-open in LO
The File-open-dialog points to some older folder I used like yesterday or so.

Question: How can I make LO to at least take over the folder of the first document opened when I start LO by the filemanager? Or better: can one make LO always to default the open-dialog to the folder / path of the current LO window? The later would be the sanest default in my case

What is the latest version in that respository? Is it the LO 25.8.3?

Just launch the desired LO application, and open the first document from the LO (File - Open…) The LO will remember the path of the last opened document, if

  • you are using the Open/Save dialogue of the LibreOffice (instead of the Open/Save dialogue of the operating system).
  • the personal data are filled-in in the LibreOffice.

You can make your own Open (and Save) Dialog procedure by some macro programming. You can assign that macro Subroutine to some user defined Manu item, and Toolbar icon. Your macro can get the path of the actual document, where the macro was launched from, or - when the new actual document has not a path yet -, the macro can use a predefined Path hardcoded in the macro code. And you can preset the desired Path of the dialog before it will be appeared.

libreoffice-fresh 25.8.3-2
libreoffice-still 25.2.7-3

I use both versions depending on the PC I use…

OK this requirement is the first time to read for me. Can’t make technical sense of it by now…

Tools - Options - User Data
When this page is empty, then the LO will nor remember some important settings. Fill-in at least the name…

I cant speak for others but in most cases I work with the filemanager method as I often need to start different programs for files which are in the same or very nearby folders. So its the most convenient method.

OK, I believe you, but I can’t make sense of why LO would e.g. not remember a path if I do not enter a name and or address. There is no logic connection.

Tools - Option - General - Use LibreOffice dialogue boxes
The dialogs of the operating system and the dialogs of the LibreOffice will work differently. (I tried is on Windows).
You can set one of them statically in the Settings, or you can choose one of them dinamically by your macro.

1 Like

I can’t remember using LO internal dialogs since like sunoffice on OS/2…
I will test if they improve anything…

… but of course my user expectation is

  • both are functional identical
  • or its bold in the dialogs and or help that there is a difference

https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://wiki.documentfoundation.org/images/8/85/LibOBasic_06_Dialogs_Flat_A4_EN_v105.pdf&ved=2ahUKEwjHhoKio4WRAxUB9gIHHXxvEmw4ChAWegQIFhAB&usg=AOvVaw0xu4rgiyOJLgUxX1rs6kKQ

1 Like

LibreOffice: XFilePicker Interface Reference

1 Like

Here is a sample macro in the sample document.
The macro controls the appeared path of the enforced Office File Picker, depended on the Path of the document where the macro was launched from.
Getpaths.ods (19.9 KB)

1 Like

with 20 loc instead 55:

from pathlib import Path
from uno import fileUrlToSystemPath as to_path

createUnoService = XSCRIPTCONTEXT.ctx.ServiceManager.createInstance
pathsubstitution = createUnoService('com.sun.star.util.PathSubstitution')
substitute = pathsubstitution.substituteVariables

def get_file_from_document_folder(*_):
    doc = XSCRIPTCONTEXT.getDocument()
    if (url:=doc.URL):
        folder = Path( to_path( url ) ).parent.as_uri()
        # or since python 3.13:
        #folder = Path.from_uri( url ).parent.as_uri()
    else:
        folder = substitute("$(work)", True)
    file_picker = createUnoService("com.sun.star.ui.dialogs.OfficeFilePicker")
    file_picker.setDisplayDirectory(folder)
    if file_picker.execute():
        desktop = XSCRIPTCONTEXT.getDesktop()
        desktop.loadComponentFromURL( file_picker.Files[0], "_default", 0, (),  )
1 Like