Home Download Buy Blog Forum Support

DDE commands

DDE commands

Postby Marciano on Sat Oct 10, 2009 2:30 pm

Hi,

this is really a question for jps. Is it OK to include the GPL-licensed "ddeclient" command-line utility (from Emacs)? IT provides a simple way to send DDE commands to programs that implement the DDE server protocol (including Acrobat, Sumatra PDF, etc.).

DDE functionality is provided by the pywin32 package, but that's a pretty big dependency for a single package!

Alternatively, one could use ctypes to access the ddeml DLL functions directly [or perhaps ST might implement DDE calls in a future version...]. This is the hard way ;-) so it would be nice if one could take a shortcut!

M

PS: the LaTeX plugin I am developing is shaping up nicely, IMHO. I'd be honored if you wanted to include it in a future release.
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am

Re: DDE commands

Postby jps on Sun Oct 11, 2009 4:59 am

Distributing GPLed executables and calling them from Python is fine from a legal POV, yeah. Relying on ddeclient sounds more pleasant than going via ctypes too.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: DDE commands

Postby Marciano on Fri Oct 16, 2009 12:52 am

So I ended up implementing DDE Execute commands in python, using ctypes. The code is in the LaTeX package: see the file DDEExecute.py, which implements the "sendDDEExecute" command, with the following syntax:

sendDDEExecute <service> <topic> <command>

For instance, to get SumatraPDF to jump to a point in the file "file.pdf" corresponding to line 100, column 1 of "file.tex" (actually, the column is disregarded at this time), the command is

sendDDEExecute "SUMATRA" "control" "[ForwardSearch("c:\file.pdf","c:\file.tex",100,1)]"

Maybe this may be useful in other applications (e.g. telling a web browser to reload the current page, etc.).

The file DDEExecute.py is independent of the LaTeX package; it is only used by it.

M
Marciano
 
Posts: 146
Joined: Fri Sep 18, 2009 2:55 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 11 guests