1send(n)                      Tk Built-In Commands                      send(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       send - Execute a command in a different application
9

SYNOPSIS

11       send ?options? app cmd ?arg arg ...?
12______________________________________________________________________________
13

DESCRIPTION

15       This command arranges for cmd (and args) to be executed in the applica‐
16       tion named by app.  It returns the result or error  from  that  command
17       execution.  App may be the name of any application whose main window is
18       on the display containing the sender's main window;   it  need  not  be
19       within  the  same  process.   If no arg arguments are present, then the
20       command to be executed is contained entirely within the  cmd  argument.
21       If one or more args are present, they are concatenated to form the com‐
22       mand to be executed, just as for the eval command.
23
24       If the initial arguments of the command begin with “-” they are treated
25       as options.  The following options are currently defined:
26
27       -async Requests asynchronous invocation.  In this case the send command
28              will complete immediately without waiting for cmd to complete in
29              the  target application;  no result will be available and errors
30              in the sent command will be ignored.  If the target  application
31              is  in  the  same  process  as  the sending application then the
32              -async option is ignored.
33
34       -displayof pathName
35              Specifies that the target application's main window  is  on  the
36              display  of the window given by pathName, instead of the display
37              containing the application's main window.
38
39       --     Serves no purpose except to terminate the list of options.  This
40              option is needed only if app could contain a leading “-” charac‐
41              ter.
42

APPLICATION NAMES

44       The name of an application is set initially from the name of  the  pro‐
45       gram  or script that created the application.  You can query and change
46       the name of an application with the tk appname command.
47

DISABLING SENDS

49       If the send command is removed from an application (e.g.  with the com‐
50       mand  rename send {}) then the application will not respond to incoming
51       send requests anymore,  nor will it be able to issue outgoing requests.
52       Communication can be reenabled by invoking the tk appname command.
53

SECURITY

55       The  send  command is potentially a serious security loophole. On Unix,
56       any application that can connect to your X server can send  scripts  to
57       your  applications.   These  incoming  scripts  can use Tcl to read and
58       write your files and invoke subprocesses under your  name.   Host-based
59       access control such as that provided by xhost is particularly insecure,
60       since it allows anyone with an account on particular hosts  to  connect
61       to your server, and if disabled it allows anyone anywhere to connect to
62       your server.  In order to provide at least a small amount of  security,
63       Tk  checks  the access control being used by the server and rejects in‐
64       coming sends unless (a) xhost-style access  control  is  enabled  (i.e.
65       only  certain  hosts can establish connections) and (b) the list of en‐
66       abled hosts is empty.  This means that applications cannot  connect  to
67       your  server  unless  they use some other form of authorization such as
68       that provide by xauth.  Under  Windows,  send  is  currently  disabled.
69       Most of the functionality is provided by the dde command instead.
70

EXAMPLE

72       This  script fragment can be used to make an application that only runs
73       once on a particular display.
74              if {[tk appname FoobarApp] ne "FoobarApp"} {
75                  send -async FoobarApp RemoteStart $argv
76                  exit
77              }
78              # The command that will be called remotely, which raises
79              # the application main window and opens the requested files
80              proc RemoteStart args {
81                  raise .
82                  foreach filename $args {
83                      OpenFile $filename
84                  }
85              }
86

KEYWORDS

88       application, dde, name, remote execution, security, send
89
90
91
92Tk                                    4.0                              send(n)
Impressum