question

barbara.bukhvalova avatar image
17 2 6 10

Eikon COM RSearch in R

I am trying to get Eikon COM Rsearch to work with R

I have some rather old code that I am trying to revive as it was at least partially working

I am using these libraries in R:

require(RDCOMClient)
require(audio)

I have tried creating connection in two ways:

eikon = COMCreate("EikonDesktopDataAPI.EikonDesktopDataAPI")

(a la C# tutorial here)

eikon = COMCreate("EikonDesktopDataAPILib.EikonDesktopDataAPI")

(from my old code). Both do not work but errors are different

> eikon = COMCreate("EikonDesktopDataAPI.EikonDesktopDataAPI")
Error: Invalid class string
In addition: Warning message:
In getCOMInstance(name, force = TRUE, silent = TRUE) :
  Couldn't get clsid from the string
> eikon = COMCreate("EikonDesktopDataAPILib.EikonDesktopDataAPI")
Error in COMCreate(guid, existing = FALSE) : 
  Failed to create COM object: Class not registered

I also created a registry key ({89CB9AA2-9658-4D64-A86F-C6A4D89778BF}) for dex2.dll, as advised previously. Not sure if the key is the same still. Also, not sure if there is also a key one needs for rsearch.dll or rsearchagent.dll. Obviously, I have not gotten that far quite yet...

eikoneikon-com-apir
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Alex Putkov.1 avatar image
39.3k 76 11 27

@barbara.bukhvalova

These errors are due to the fact that DEX2 and RSearch libraries are reg free COM dlls. You could get around this by manually creating registry entries for the type libraries. However, if the objective is to use RSearch library in R, I'm afraid this might be a dead end. The reason is that the interface of RSearch library only allows to access the search results from the OnUpdate event handler. And RDCOMClient does not support handling of COM events in R. There used to be a package named RDCOMEvents, but it hasn't been maintained in 15 years and I don't believe it still works. You could try implementing event handling for RSearch library following this article. I haven't tried it myself and can't tell you if it works.

10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Alex Putkov.1 avatar image
39.3k 76 11 27

COMCreate("EikonDesktopDataAPILib.EikonDesktopDataAPI") is the correct command. This COM library is registered. You can find EikonDesktopDataAPILib.EikonDesktopDataAPI class listed under HKCR\CLSID registry hive. Since it's a 32-bit library, its class GUIDs appear in the registry under Wow6432 node. Judging by the fact that your R interpreter complains it cannot find CLSID registry entry for EikonDesktopDataAPILib.EikonDesktopDataAPI, I suspect you must be using 64-bit R. All Eikon COM APIs libraries are 32-bit and can only be used in 32-bit applications.

1 comment
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you @alex-putkov. This was indeed part of the problem.

Now,

eikon = COMCreate("EikonDesktopDataAPILib.EikonDesktopDataAPI")
eikon$Initialize()

execute without errors.

The next step also gets executed without errors but with a warning

rsearchmgr = eikon$CreateRSearchMgr()
Warning message:
In createCOMReference(<pointer: 0x1aa6c2ac>, "COMUnknown") :
  Using COMIDispatch instead of COMIDispatch

However, the warning is not innocuous: the next line throws an error:

cookie = rsearchmgr$Initialize()
Error in .COM(x, name, ...) : 
  Cannot locate 0 name(s) Initialize in COM object (status = -2147319779)

The same problem for dex2:

cookie = dex2mgr$Initialize()

Could you please provide the rest of the steps including a simple search example?