---
title: appleEvent
card_id: 73723
modified: yes
---

# appleEvent

`appleEvent [ph:class], [ph:id], [ph:sender]`

Handler:

```
on appleEvent class, id, sender
    [ph:statements]
end appleEvent
```

HyperCard sends the `appleEvent` message to the current card when it receives an Apple event from another program. It sends the message at idle time as soon as all pending handlers have finished running.

`[ph:class]` is the general category of the event (such as `aevt` or `misc`), `[ph:id]` is the actual event received (such as `odoc`, `pdoc`, `dosc`, or `eval`), and `[ph:sender]` is the name of the application or process that sent the event.

Because Apple event commands are usually generated by other processes, you may want to check to make sure that they are not destructive. Click Examples to see a handler, written for the Home stack, that intercepts an incoming Apple event.

You'll see lots of `appleEvent` messages in the message watcher when HyperCard is being controlled by AppleScript from another application.

Apple events generated internally when HyperCard runs AppleScript don’t produce `appleEvent` messages.

Use the request command within an `appleEvent` handler to obtain additional information about the event.

You don't have to define an `appleEvent` handler to enable HyperCard to handle Apple events. Use an `appleEvent` handler only if you need to get a peek at the incoming Apple events or to handle them yourself.

The `appleEvent` message occurs only under System version 7.0 and later.

## Examples

```
on appleEvent class, id, sender
  answer "HyperCard has received an AppleEvent!" & return & ¬
  "The class is" && class & return & ¬
  "The ID is" && id & return & ¬
  "The Sender is" && sender with "Allow" or "Deny"
  if it is "Allow" then pass appleEvent
end appleEvent
```

## Related Topics

* [reply](/HyperTalkReference/commands/reply)
* [request](/HyperTalkReference/commands/request)
