Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » System messages

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

appleEvent

appleEvent class, id, sender

Handler:

on appleEvent class, id, sender
    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.

class is the general category of the event (such as aevt or misc), id is the actual event received (such as odoc, pdoc, dosc, or eval), and 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

Placeholders

statements
Any return-separated list of built-in commands, user-defined handlers, or keywords that are part of a message or function handler.

put "Hello world"   -- built-in command
get total(field 1)  -- function call
global HelpInfo     -- keyword


Related Topics

« Where messages are sent initially | HyperTalk Reference | closeBackground »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View