- Sending AppleEvents
  - tclAE::launch
  - tclAE::processes
  - tclAE::remoteProcessResolverGetProcesses
  - tclAE::send

This page describes Tcl® calls for sending AppleEvents. For information on the associated ToolBox calls, see INSIDE MACINTOSH: Interapplication Communication.

# Sending AppleEvents

## `tclAE::launch`

Launch the specified application

### Synopsis

`tclAE::launch [flags] name`

### Result

The Process Serial Number `AEAddress` of the launched application.

### Description

Launch the named app into the background. `name` can be any of bundle ID (`bund(Ònet.sourceforge.alphatclÓ)`), creator code (`'ALFA'`), full application name (`Alpha.app`), or path (`/Applications/AlphaX.app`).

`flags` can be:

`-foreground`
  launch the application in the foreground
`-newInstance`
  launch a new instance of this app, rather than returning the PSN of an instance that is already running.

For some yet unexplained reason, some applications (Microsoft Word) won't launch completely in the background. `[launch]`ing such applications won't insert the application into any system menu that specifies running applications (although "About the Finder..." will list it. The only way to get to such an app is through Alpha's `[switchTo]`, after which the application will finish launching. The '`-foreground`' option gets around this by launching the application in the foreground instead.
This is probably irrelevant on Mac OS X

## `tclAE::processes`

List information about running processes

### Synopsis

`tclAE::processes`

### Result

A list of lists for each running processes. Each process list consists of the name, signature, process type, launch time, PSN, and application path.

### Description

Return information about the running processes.

## `tclAE::remoteProcessResolverGetProcesses`

List information about running processes on a remote machine

### Synopsis

`tclAE::remoteProcessResolverGetProcesses eppc://steveo.apple.com`

### Result

A list of lists for each running processes. Each process list consists of the application URL, name of the application, `uid` of the user running the application, and `pid` of the application.

### Description

Return information about the running processes on a remote machine. Loosely equivalent to `tclAE::processes` on the local machine.

## `tclAE::send`

send the specified AppleEvent

### Synopsis

`tclAE::send [flags] anAddress aeclass aeeventID [event parameters]*`

### Result

### Description

`flags` can be:

`-dr`
  don't record (when used with `-s` flag)
`-dx`
  don't execute (when used with `-s` flag)
`-Q eventHandlerProc`
  queued reply requested (handler proc specified directly)
`-q`
  queued reply requested (register handler with currentReplyHandler). This flag is deprecated and only supported in Alpha for legacy code. Use `-Q`.
`-r`
  direct reply requested
`-s`
  send event to "self" (`kCurrentProcess`). Omit `anAddress` if `-s` is used
`-t timeout`
  specifies event timeout in ticks
`-z transactionID`
  indicates that event is part of an ongoing transaction with the target (obtained from a `misc/begi` event).
`--`
  don't process further flags

Copyright © 1999Ð2007 Jonathan E. Guyer
All rights reserved.

Last modified Tuesday, July 10, 2007 8:44:43 AM