Macro to get default template location

I have been trying to find the correct macro syntax to get the default template folder location ie: the path setting in Options > LibreOffice > Paths > Templates

I think you mean something like

MsgBox Join(Split(createUnoService("com.sun.star.util.PathSettings").Template,";"),Chr(10))

Hi

There may be several paths defined. They are available as character string in the Template property.
You get the default path in the property Template_writable:

dim oContext as object

oContext = GetDefaultContext.getByName("/singletons/com.sun.star.util.thePathSettings")
print oContext.Template
print oContext.Template_writable

Regards

Thank you both JohnSUN and pierre-yves samyn.

You have pointed me in the right direction

Here is my test code:

Sub PathTesting
Dim oSettings as Object
dim oContext as object
Dim sTemplate as String
Dim sTempFolder as String

	oSettings = createUnoService("com.sun.star.util.PathSettings")
	oContext = GetDefaultContext.getByName("/singletons/com.sun.star.util.thePathSettings")

	sTemplate = oSettings.template_writable
	sTempFolder = oContext.temp_writable

	msgbox "Templates: " & sTemplate & chr(13) & "Temp Folder: " & sTempFolder
	
End Sub

Here is why I am having difficulty getting my head around LO Basic. Both createUnoService(“com.sun.star.util.PathSettings”) and GetDefaultContext.getByName("/singletons/com.sun.star.util.thePathSettings") give the same results. Which one to use? I will be including some macro code in a document I want to distribute to numerous users. I want it to be as bullet proof as possible. Will either command work with all versions of Libre Office?