Tcl Bundled Packages dde(1T)
_________________________________________________________________
NAME
dde - Execute a Dynamic Data Exchange command
SYNOPSIS
package require dde 1.2
dde eval ?-async? service cmd ?arg ...?
dde execute ?-async? service topic data
dde poke service topic item data
dde request ?-binary? service topic data
dde servername ?topic?
dde services service topic
_________________________________________________________________
DESCRIPTION
This command allows an application to send Dynamic Data Exchange (DDE) command when running under Microsoft Windows. Dynamic Data Exchange is a mechanism where applications can exchange raw data. Each DDE transaction needs a service name and a topic. Both the service name and topic are application defined; Tcl uses the service name TclEval, while the topicname is the name of the interpreter given by dde servername.
Other applications have their own service names and topics. For instance, Microsoft Excel has the service name Excel.The eval and execute commands accept the option -async:
DDE COMMANDS The following commands are a subset of the full Dynamic Data Exchange set of commands.dde servername ?topic?
dde servername registers the interpreter as a DDE
server with the service name TclEval and the topic namespecified by topic. If no topic is given, dde server-
name returns the name of the current topic or the empty string if it is not registered as a service.dde execute ?-async? service topic data
dde execute takes the data and sends it to the server
indicated by service with the topic indicated by topic. Typically, service is the name of an application, and topic is a file to work on. The data field is given todde Last change: 1.2 1
Tcl Bundled Packages dde(1T)
the remote application. Typically, the application treats the data field as a script, and the script isrun in the application. The -async option requests
asynchronous invocation. The command returns an errormessage if the script did not run, unless the -async
flag was used, in which case the command returns immediately with no error.dde poke service topic item data
dde poke passes the data to the server indicated by
service using the topic and item specified. Typically,service is the name of an application. topic is appli-
cation specific but can be a command to the server orthe name of a file to work on. The item is also appli-
cation specific and is often not used, but it mustalways be non-null. The data field is given to the
remote application.dde request ?-binary? service topic item
dde request is typically used to get the value of some-
thing; the value of a cell in Microsoft Excel or thetext of a selection in Microsoft Word. service is typi-
cally the name of an application, topic is typicallythe name of the file, and item is application-specific.
The command returns the value of item as defined in the application. Normally this is interpreted to be astring with terminating null. If -binary is specified,
the result is returned as a byte array.dde services service topic
dde services returns a list of service-topic pairs that
currently exist on the machine. If service and topicare both null strings ({}), then all service-topic
pairs currently available on the system are returned. If service is null and topic is not, then all services with the specified topic are returned. If service is not null and topic is, all topics for a given serviceare returned. If both are not null, if that service-
topic pair currently exists, it is returned; otherwise, null is returned.dde eval ?-async? topic cmd ?arg arg ...?
dde eval evaluates a command and its arguments using
the interpreter specified by topic. The DDE servicemust be the TclEval service. The -async option
requests asynchronous invocation. The command returns an error message if the script did not run, unless the-async flag was used, in which case the command returns
immediately with no error. This command can be used to replace send on Windows.dde Last change: 1.2 2
Tcl Bundled Packages dde(1T)
DDE AND TCL A Tcl interpreter always has a service name of TclEval. Each different interpreter of all running Tcl applicationsmust be given a unique name specified by dde servername.
Each interp is available as a DDE topic only if the dde ser-
vername command was used to set the name of the topic foreach interp. So a dde services TclEval {} command will
return a list of service-topic pairs, where each of the
currently running interps will be a topic.When Tcl processes a dde execute command, the data for the
execute is run as a script in the interp named by the topicof the dde execute command.
When Tcl processes a dde request command, it returns the
value of the variable given in the dde command in the con-
text of the interp named by the dde topic. Tcl reserves the
variable $TCLEVAL$EXECUTE$RESULT for internal use, and dde
request commands for that variable will give unpredictable results. An external application which wishes to run a script in Tcl should have that script store its result in a variable, runthe dde execute command, and the run dde request to get the
value of the variable. When using DDE, be careful to ensure that the event queue is flushed using either update or vwait. This happens by default when using wish unless a blocking command is called (such as exec without adding the & to place the process in the background). If for any reason the event queue is not flushed, DDE commands may hang until the event queue is flushed. This can create a deadlock situation.EXAMPLE
This asks Internet Explorer (which must already be running) to go to a particularly important website:package require dde
dde execute iexplore WWW_OpenURL http://www.tcl.tk/
SEE ALSO
tk(1T), winfo(1T), send(1T) KEYWORDSapplication, dde, name, remote execution
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:dde Last change: 1.2 3
Tcl Bundled Packages dde(1T)
_______________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE|
|____________________|__________________|_
| Availability | runtime/tcl-8 |
|____________________|__________________|_
| Interface Stability| Uncommitted ||____________________|_________________|
NOTES Source for Tcl is available on http://opensolaris.org.dde Last change: 1.2 4