Ask Your Question

Accessing a singleton

asked 2017-08-30 09:35:00 +0100

Zev Spitz gravatar image

updated 2017-08-30 10:06:58 +0100

The type is deprecated, and it is recommended to use the singleton instead.

How can I acces this (and other) singletons?

In Java, this thread says the following works:

However, the namespace isn't available under the Automation bridge; there is only the single entry point of the service manager:

var objServiceManager = new ActiveXObject('');
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2017-08-30 17:29:47 +0100

librebel gravatar image

hello Zev Spitz,

you need to get the Default Context from the ServiceManager, then call getName() with the singleton path as argument.

i do not know enough Java, but in Basic it would look like this, so you get the idea:

theDesktop = GetDefaultContext().getByName( "/singletons/" )

Hope it helps, lib

edit flag offensive delete link more


I am not asking about Java, but rather using the Automation bridge. How do I get the script context via the Automation bridge?

Zev Spitz gravatar imageZev Spitz ( 2017-09-03 14:33:56 +0100 )edit

answered 2017-09-03 14:37:10 +0100

Zev Spitz gravatar image

The Automation bridge exposes the script context at the DefaultContext property on the service manager. Once we have the script context, we can use the getByName method, passing in the singleton path:

var serviceManager = new ActiveXObject('');
var desktop = serviceManager.defaultContext.getByName('/singletons/');

(I was led to the solution by this post where the author is trying to automate OpenOffice using Delphi.)

Question on StackOverflow

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2017-08-30 09:35:00 +0100

Seen: 94 times

Last updated: Sep 03 '17