Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve data with DDE in R using tcltk2 library

Tags:

r

excel

tcl

dde

tcltk2

Connecting Excel with 'ABC' throught Excel works, connecting R with Excel by DDE works also, but how to connect R with 'ABC' application ?

I have application providing DDE interface, from Excel I could retrieve value from it with this DDE reference :

='ABC'|DDE!_nazwa_value

from R I've tried to use tcltk2 library, as follows :

tcltk2::tk2dde.request(service="ABC", topic="DDE", item="_nazwa_value")

but error occurs :

Error in structure(.External(.C_dotTcl, ...), class = "tclObj") : 
  [tcl] remote server cannot handle this command.

[1] "Error in structure(.External(.C_dotTcl, ...), class = \"tclObj\") : \n  [tcl] remote server cannot handle this command.\n\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in structure(.External(.C_dotTcl, ...), class = "tclObj"): [tcl] remote server cannot handle this command.

I'm only trying to use tcltk dde functions to retrieve data from application, I think that item part of my tk2dde.request is wrong, but I've tried various modification (without _ for example), do you know any clues or resources for solving this problem ?

EDIT

something is wrong I don't see ABC server nor DDE topic on server-topic list : tk2dde.services() but Excel can still connect and retrieve value using ='ABC'|DDE!_nazwa_value, DDE Query also do not see it

like image 633
Qbik Avatar asked Sep 09 '18 16:09

Qbik


1 Answers

You can read in the article about DDE in tcl/tk wiki:

(Talking about using Internet Explorer) ... All of the above experiments should "work" reliably, in that, from the user perspective, IE indeed acts as described. However, back in the Tcl process, [dde] typically throws a "remote server cannot handle this command" exception. That's because, in KBK's analysis, DDE gives no "way to distinguish 'result expected, but the server failed to provide it' from 'no result is expected'." The only way not to receive a DMLERR_NOTPROCESSED is to invoke "dde exec -async ..."

Note: i tried tcl examples of DDE using Excel + "request" and i got the same error as you: "remote server cannot handle this command".

Saludos!,

like image 62
L. Alejandro M. Avatar answered Oct 23 '22 12:10

L. Alejandro M.