Dynamic copy/paste using DDE with Python on Windows

Eric Brunel eric.brunel at pragmadev.com
Wed Oct 16 08:41:27 EDT 2002


Anders M Eriksson wrote:
[snip]
> In win32extension of Python you have a module dde that lets you handle
> dde both as a server and as a client. There are very little
> documentation but since dde is a windows api you can use MSDN for
> documentation.
> 
> If I understand you correctly you want to create a DDE server that can
> distribute text documents via the clipboard.
> 
> You will then need to create a server 'myServer', that has a topic
> 'copy' and then execute this topic from a dde client. meServer will
> then read the document and put it on the ClipBoard and you can now use
> paste in Word to insert the document into your Word document.
> 
> You will of cause need to create a Word VBA script that is the dde
> client and calls meServer for the document.

Thanks for the explanation, but there's apparently a little 
misunderstanding: what I want to do is use the regular "Paste special..." / 
"Paste link" feature in Word. In fact, the application is not only for me: 
other people will have to use it and creating a macro acting as the DDE 
client in each copy of Word for each person using this feature is really 
impossible.

Concerning your other post (DDE: supported or not? broken or not?), again 
thanks, but what I'm interested in is just whether the mechanism used to 
paste DDE links in Word is still used or not. Apparently, it's not: I tried 
to copy a refrence to a DDE topic/item in the clipboard the way it's 
described in the MSDN docs (custom clipboard format "Link", reference 
formatted like "application\0topic\0item\0\0"), but Word refused to paste 
anything from it. The DDE server seemed to work since inserting the DDE 
reference in Excel ("application|topic!item") works. But the "paste link" 
thing does not.

Maybe I've done something wrong, since there are many things that I didn't 
quite understand. So maybe you have an example working with the regular 
"paste link" feature? If so, I would appreciate any help you can give.
-- 
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com



More information about the Python-list mailing list