NAME
dde - Execute a Dynamic Data Exchange command
SYNOPSIS
dde ?-async? command service topic ?data?
DESCRIPTION
-async
DDE COMMANDS
dde execute service topic data
dde request service topic item
dde services service topic
DDE AND TK
KEYWORDS
SEE ALSO

NAME

dde - Execute a Dynamic Data Exchange command

SYNOPSIS

dde ?-async? command service topic ?data?

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; Tk uses the service name Tk, while the topic name is the name of the interpreter given by tk appname. Other applications have their own service names and topics. For instance, Microsoft Excel has the service name Excel.

The only option to the send command is:

-async
Requests asynchronous invocation. This is valid only for the execute subcommand. Normally, the dde execute subcommand waits until the command completes, returning appropriate error messages. When the -async option is used, the command returns immediately, and no error information is available.

DDE COMMANDS

The following commands are a subset of the full Dynamic Data Exchange set of commands.

dde execute 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 to the remote application. Typically, the application treats the data field as a script, and the script is run in the application. The command returns an error if the script did not run. If the -async flag was used, the command returns immediately with no error.

dde request service topic item
dde request is typically used to get the value of something; the value of a cell in Microsoft Excel or the text of a selection in Microsoft Word. service is typically the name of an application, topic is typically the name of the file, and item is application-specific. The command returns the value of item as defined in the application.

dde services service topic
dde services returns a list of service-topic pairs that currently exist on the machine. If service and topic are 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 service are returned. If both are not null, if that service-topic pair currently exists, it is returned; otherwise, null is returned.

DDE AND TK

Tk always has a service name of "Tk". Each different interp of all running Tk applications has a unique name. A list of running interps can be retrieved using the winfo interps command. A given interp's name can be set with the tk appname. Each interp is available as a DDE topic. So a dde services Tk {} command will return a list of service-topic pairs, where each of the currently running interps will be a topic.

When Tk processes a dde execute command, the data for the execute is run as a script in the interp named by the topic of the dde execute command.

When Tk processes a dde request command, it returns the value of the variable given in the dde command in the context of the interp named by the dde topic. Tk reserves the variable "$TK$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 Tk should have that script store its result in a variable, run the dde execute command, and the run dde request to get the value of the variable.

KEYWORDS

application, dde, name, remote execution

SEE ALSO

tk, winfo, send
Copyright © 1997 Sun Microsystems, Inc.
Copyright © 1995-1997 Roger E. Critchlow Jr.