Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


SendAE

Tool

SYNTAX

SendAE -e classAndID [-do] [-dot] [-hiprio] [-m sendMode]
[-rid returnID] [-t [target]] [-tid transactionID]
[-timeout ticks] [-u userName] [Apple Event parameters]…

DESCRIPTION

SendAE is an MPW tool for sending Apple Events to other Apple Event-aware applications.

INPUT

None

OUTPUT

If AESend returns an error, it will be sent to the diagnostic output. If you asked for a reply, the 'errn' and 'errs' will also be sent to the diagnostic output. Other parameters in the reply will be written in the AEPrint format as follows:

key1: data for key 1 in AEPrint format
key2: data for key 2 in AEPrint format

STATUS

SendAE can return the following status codes:

0

no error

1

parameter or option error

PARAMETERS

[Apple Event parameters]…

The Apple Event parameters are specified as follows:

-xxxx data

Apple Event parameter in AEBuild format, xxxx is the keyword.

-xxxxyyyy data

Apple Event parameter in yyyy format, xxxx is the keyword.

-@xxxx data

Apple Event attribute in AEBuild format, xxxx is the keyword.

-@xxxxyyyy data

Apple Event attribute in yyyy format, xxxx is the keyword.

The advantage of using AEBuild format is that any arbitrary complex descriptor can be built. The disadvantage is that the rest of the MPW tools do not understand the format, therefore, SendAE also allows text strings as input and output so that the result can be piped to and from other tools. This can be done by adding TEXT after the keyword so that -xxxxTEXT means that the descriptor is the text string that follows. Other data types are also allowed so that -xxxxyyyy will coerce the data text string into type yyyy. For example, -xxxxlong 25 will produce a descriptor with type 'long' and with value 25.

There are two pseudo descriptor types available. If yyyy = file, then the parameter data is a file name, and the data from that file is made into a descriptor. Currently, only TEXT descriptors are allowed. If yyyy = alis, the parameter data is a list of file names, and the descriptor will be a list of aliases based on the list of filenames. This means that you can do something like:

SendAE -e aevtodoc -t AevtSample -----alis ≈.fun

Note
One change has been made to the AEBuild format; double-quote (") is used instead of single-quote (') because single-quote is used in the MPW shell. •

OPTIONS

-do

Only the data in the direct object of the reply will be sent to the output.

-dot

Same as -do, but the output will be in TEXT rather than in AEPrint format. This can be useful if you want to pipe the output to other MPW tools such as Sort.

-e classAndID

Eight characters to denote event class and ID. This option is required.

-hiprio

High priority message. Default is AENormalPriority.

This option is used to request that the message be posted at the front of the event queue. If not specified, messages are handled as normal priority messages to be placed at the end of the queue.

-m sendMode

Specifies the send mode. Default is kAEWaitReply.

-rid returnID

Specifies the return ID. Default is kAutoGenerateReturnID.

-t [target]

Specifies the target application. Default is "{AETargetID}".

Use the name SELF (i.e., -t self) if you want to send the command to the MPW Shell. If the -t option is specified without a parameter, the PPCBrowser will be invoked. If the -t option is not specified, the Shell variable {AETargetID} will be used. If the {AETargetID} variable doesn't exist, the PPCBrowser will be used.

The target application can be specified with a network path to send the AppleEvent to a specified machine on the network. Valid forms are:

[DomainName:]application
[IPAddress:]application
[[Zone]:Server:]application

Note
The underlying version of Mac OS must support IP connectivity for Apple Events (Mac OS 9 or later) in order to specify the target application using a Domain Name or IP Address. •

If a network path is specified, a remote session is established to the specified target. Otherwise, if you have installed a TEXT to target ID coercion, it will be used. If you don't have one, an internal TEXT to PSN coercion is used, but this is restricted to applications located on the same machine.

-tid transactionID

Transaction ID. Default is kAnyTransactionID.

-timeout ticks

Time out in ticks. Default is kAEDefaultTimeout.

-u userName

Specifies the user name. By default, SendAE will login (if required) to the remote server specified in the -t option using the default user identity (i.e., the user name from the Sharing Setup Control panel) or as guest (if the default user reference number cannot be obtained).

EXAMPLES

Here is an example of a script that uses the Apple Event MAGITPSE, which transposes text. It will take each file with the name ending in '.test', transpose its contents, put it into another file ending in '.test.rev', and then ask the application TETester to open these files.

FOR name IN ≈.test
  SendAE -e MAGITPSE -t domagic -dot -----file {name} > {name}.rev
END
SendAE -e aevtodoc -t "TETester" -m 1 -----alis ≈.rev

SEE ALSO

Find

 
 


Last Updated July 2000