- Handling AppleEvent Descriptor Coercions
  - tclAE::installCoercionHandler
  - tclAE::getCoercionHandler
  - tclAE::removeCoercionHandler
- Handling AppleEvents
  - tclAE::installEventHandler
  - tclAE::getEventHandler
  - tclAE::removeEventHandler
- Path Conversion
  - tclAE::getHFSPath
  - tclAE::getPOSIXPath

This page describes Tcl® calls for handling received AppleEvents and AppleEvent descriptor type coercion requests. For information on the associated ToolBox calls and data types, see INSIDE MACINTOSH: Interapplication Communication.

# Handling AppleEvent Descriptor Coercions

## `tclAE::installCoercionHandler`

Tcl wrapper for ToolBox AEInstallCoercionHandler call.

### Synopsis

`tclAE::installCoercionHandler fromType toType coercionHandlerProc`

### Result

None.

### Description

This call allows Tcl procs to act as `AEDesc` coercion handlers.

## `tclAE::getCoercionHandler`

Tcl wrapper for ToolBox `AEGetCoercionHandler` call.

### Synopsis

`tclAE::getCoercionHandler fromType toType`

### Result

Name of Tcl coercion `proc`.

### Description

The Tcl® coercion hash table is searched for the `proc` mapped by `fromType` and `toType`.

If the AEM has a registered coercion handler that is not a Tcl `proc`, the Result will be empty, but no error is thrown. Tell me how you want this to work!!!

Throws `OSErr -1717` (`errAEHandlerNotFound`) if there is no entry in the coercion hash table.

## `tclAE::removeCoercionHandler`

Tcl wrapper for ToolBox `AERemoveCoercionHandler` call.

### Synopsis

`tclAE::getCoercionHandler fromType toType coercionHandlerProc`

### Result

None.

### Description

The Tcl® coercion hash table is searched for the `proc` mapped by `fromType` and `toType` and matched with `coercionHandlerProc`. Although the `fromType` and `toType` parameters would be sufficient to identify the handler to be removed, providing the `coercionHandlerProc` parameter is a safeguard to ensure that you remove the correct handler.

Throws `OSErr -1717` (`errAEHandlerNotFound`) if there is no matching entry in the Tcl®Õs coercion hash table.

# Handling AppleEvents

## `tclAE::installEventHandler`

Tcl wrapper for ToolBox `AEInstallEventHandler` call.

### Synopsis

`tclAE::installEventHandler aeclass aeeventID eventHandlerProc`

### Result

None.

### Description

This call allows a Tcl `proc` to act as an AppleEvent handler.

## `tclAE::getEventHandler`

Tcl wrapper for ToolBox `AEGetEventHandler` call.

### Synopsis

`tclAE::getEventHandler aeclass aeeventID`

### Result

Name of Tcl AppleEvent handler `proc`.

### Description

The Tcl® event handler hash table is searched for the `proc` mapped by `aeclass` and `aeeventID`.

If the AEM has an event handler that is not a Tcl `proc`, the Result will be empty, but no error is thrown. Tell me how you want this to work!!!

Throws `OSErr -1717` (`errAEHandlerNotFound`) if there is no entry in the event handler hash table.

## `tclAE::removeEventHandler`

Tcl wrapper for ToolBox AEGetEventHandler call.

### Synopsis

`tclAE::getCoercionHandler aeclass aeeventID eventHandlerProc`

### Result

None.

### Description

The Tcl® event handler hash table is searched for the `proc` mapped by this `aeclass` and `aeeventID` and matched with `eventHandlerProc`. Although the `aeclass` and `aeeventID` parameters would be sufficient to identify the handler to be removed, providing the `eventHandlerProc` parameter is a safeguard to ensure that you remove the correct handler.

Throws `OSErr -1717` (`errAEHandlerNotFound`) if there is no matching entry in the coercion hash table.

# Path Conversion

## `tclAE::getHFSPath`

Convert POSIX path to HFS path

### Synopsis

`tclAE::getHFSPath /some/posix/path`

### Result

HFS path

### Description

This call converts a POSIX path to an HFS path

## `tclAE::getPOSIXPath`

Convert HFS path to POSIX path

### Synopsis

`tclAE::getPOSIXPath some:hfs:path`

### Result

POSIX path

### Description

This call converts an HFS path to a POSIX path

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

Last modified Tuesday, July 10, 2007 8:54:09 AM