Ask Your Question

How do I create an instance of a singleton?

asked 2018-02-27 20:10:41 +0200

ptoye gravatar image

Title says it all, really. I want to get hold of which is defined as a singleton. But the documentation (either on the LO or AOO sites) doesn't seem to have anything about how to use singletons. How do I get hold of it so I can look at the various paths?

Just writing doesn't work, so I obviously have to create the instance before I can get hold of the attribute.

createUNOservice("") doesn't work either.

I'm using LO Basic.

I'm certainly missing something simple, but what is it?

edit retag flag offensive close merge delete


a similar request for another singleton: tdf#97447

Mike Kaganski gravatar imageMike Kaganski ( 2018-02-27 20:19:41 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2018-02-28 10:34:55 +0200

librebel gravatar image

Hello @ptoye,

Please try the following:

Dim oPS Object
oPS=  GetDefaultContext().getByName( "/singletons/" )
edit flag offensive delete link more


Brilliant. Thanks. Shame it doesn't seem to be documented anywhere, at least on the LibO or AOO sites.

ptoye gravatar imageptoye ( 2018-03-01 12:38:54 +0200 )edit

answered 2018-02-28 04:10:32 +0200

Jim K gravatar image is an ordinary service.

pathSettings = createUnoService("")
MsgBox pathSettings.getPropertyValue("Template")
edit flag offensive delete link more


Thanks. Agreed. But I'm afraid that it doesn't answer the question I asked. PathSettings is deprecated - see

That's why I asked about thePathSettings

The question is really about how to create a singleton, not necessarily about this particular one. Hence the title of the thread.

ptoye gravatar imageptoye ( 2018-02-28 10:26:11 +0200 )edit

Good to know, but next time please include this kind of information in the original question. It's important to describe what you've already discovered while researching the problem. See guidelines for asking.

Jim K gravatar imageJim K ( 2018-03-01 14:51:14 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-02-27 20:10:41 +0200

Seen: 71 times

Last updated: Feb 28 '18