Seth Woolley's Man Viewer

dde(n) - dde, dde - Execute a Dynamic Data Exchange command - man n dde

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

dde(n)                       Tcl Bundled Packages                       dde(n)



NAME
       dde - Execute a Dynamic Data Exchange command

SYNOPSIS
       package require dde 1.2

       dde servername ?topic?

       dde execute ?-async? service topic ?data?

       dde poke service topic item data

       dde request ?-binary? service topic ?data?

       dde services service topic ?data?

       dde eval ?-async? service topic ?data?


DESCRIPTION
       This  command allows an application to send(2,n) Dynamic Data Exchange (DDE)
       command when running under Microsoft Windows. Dynamic Data Exchange  is
       a mechanism where applications can exchange raw(3x,7,8,3x cbreak) data. Each DDE transac-
       tion needs a service name and a topic. Both the service name and  topic
       are  application  defined; Tcl uses the service name TclEval, while the
       topic name 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(2,8) the option -async:



       DDE COMMANDS

       The following commands are a subset of the full Dynamic  Data  Exchange
       set(7,n,1 builtins) of commands.

       dde servername ?topic?
              dde  servername  registers  the interpreter as a DDE server with
              the service name TclEval and the topic name specified by  topic.
              If  no  topic  is  given, dde servername returns the name of the
              current topic or the empty string(3,n) if(3,n) 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(1,n) 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(1,8) the application.  The  -async  option  requests
              asynchronous  invocation.   The command returns an error(8,n) message
              if(3,n) the script did not run, unless the -async flag was  used,  in(1,8)
              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 application specific but can
              be a command to the server or the name of a  file(1,n)  to  work  on.
              The item is also application specific and is often not used, but
              it must always 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 something; the
              value of a cell in(1,8) Microsoft Excel or the text of a selection in(1,8)
              Microsoft Word. service is typically the name of an application,
              topic is typically the name of the file(1,n), and  item  is  applica-
              tion-specific.  The command returns the value of item as defined
              in(1,8) the application.  Normally this is interpreted to be a string(3,n)
              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  cur-
              rently  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 ser-
              vice  is  not  null and topic is, all topics for a given service
              are returned. If both are not null, if(3,n) 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 inter-
              preter specified by topic. The DDE service must be  the  TclEval
              service.   The  -async  option requests asynchronous invocation.
              The command returns an error(8,n) message if(3,n) the script did not  run,
              unless  the  -async  flag  was  used,  in(1,8) which case the command
              returns immediately with no error.  This command can be used  to
              replace send(2,n) on Windows.


DDE AND TCL
       A Tcl interpreter always has a service name of TclEval.  Each different
       interpreter of all running Tcl applications must be given a unique name
       specified  by  dde  servername. Each interp is available as a DDE topic
       only if(3,n) the dde servername command was used to  set(7,n,1 builtins)  the  name  of  the
       topic for each 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(1,8) the interp named(5,8) by the topic  of  the  dde  execute
       command.

       When  Tcl  processes a dde request command, it returns the value of the
       variable given in(1,8) the dde command in(1,8) the context of the interp named(5,8) 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(1,8) Tcl should have
       that script store its result in(1,8) a variable, run the  dde  execute  com-
       mand, and the run dde request to get the value of the variable.

       When  using  DDE,  be careful to ensure that the event queue(1,3) is flushed
       using either update(7,n) or vwait.  This happens by default when using  wish
       unless  a blocking command is called (such as exec(3,n,1 builtins) without adding the &
       to place the process in(1,8) the background).  If for any reason  the  event
       queue(1,3)  is  not  flushed, DDE commands may hang until the event queue(1,3) is
       flushed.  This can create a deadlock situation.


SEE ALSO
       tk(n), winfo(n), send(2,n)(n)


KEYWORDS
       application, dde, name, remote execution



dde                                   1.2                               dde(n)

References for this manual (incoming links)