- Sending AppleEvents
  - tclAE::launch
  - tclAE::processes
  - tclAE::send
  - tclAE::IPCListPorts
  - tclAE::PPCBrowser

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`).

At this point, on Mac OS 9 or below, `name` must be a path.

`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.
  This option is only available on Mac OS X

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::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)
`-p`
  print reply with AEPrint before returning it (if absent, return parsed AEDesc identifier). This archaic flag is ignored. All replies come in AEPrinted form.
`-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

## `tclAE::IPCListPorts`

Tcl wrapper for ToolBox `IPCListPorts`.

This call is not supported on Mac OS X.

### Synopsis

    tclAE::IPCListPorts option [arg]*

### Result

A new `TargetID`.

### Description

Displays information about available ports. Legal options are:

`tclAE::IPCListPorts ppcNoLocation`
  List ports on local machine
`tclAE::IPCListPorts ppcNBPLocation objStr typeStr zoneStr`
  List ports on machine on the specified AppleTalk zone
`tclAE::IPCListPorts ppcXTIAddrLocation url`
  List ports on machine specified by internet address

## `tclAE::PPCBrowser`

Tcl wrapper for ToolBox `PPCBrowser`.

This call is not supported on Mac OS X.

### Synopsis

    tclAE::PPCBrowser [flags]

### Result

A new `TargetID`.

### Description

Display a dialog allowing the user to select an application to communicate with.

Flags are:

`-p string`
  Prompt string
`-l string`
  Label for application pane
`-fc list`
  Creator-type list
`-fn list`
  Port name list

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

Last modified Tuesday, March 2, 2004 11:46:37 PM