AEGetNthPtr
AEGetNthPtr Access data in a descriptor list
#include <AppleEvents.h> Apple Event Manager
OSErr AEGetNthPtr( theAEDescList, index, desiredType, theAEKeyword,
typeCode, dataPtr, maximumSize, actualSize );
AEDescList * theAEDescList ; descriptor list to be counted
long index ; position of descriptor record in list
DescType desiredType ; descriptor type
AEKeyword * theAEKeyword ; keyword of specified descriptor record
DescType * typeCode ; pointer to descriptor type
Ptr dataPtr ; pointer to data buffer
Size maximumSize ; maximum size of data buffer
Size * actualSize ; actual size of data field
returns Error Code; 0 = no error
You can use the AEGetNthPtr function to get a pointer to a buffer that
contains a descriptor record from any descriptor list.
The AEGetNthPtr function uses a buffer to return a specified descriptor
record from a specified descriptor list; the function attempts to coerce the
descriptor record to the descriptor type specified by the desiredType
parameter.
You can use the AEGetNthPtr and AEGetNthDesc functions to gain access to
the data in a descriptor list. You can use the AEGetArray function to get data
from an array contained in a descriptor list.
The parameter theAEDescList is the descriptor list containing the desired
descriptor record.
The index parameter specifies the position of the desired descriptor record in
the list (for example, 2 specifies the second descriptor record).
The desiredType parameter is the descriptor type of the resulting data; if the
descriptor record is not of this type, the Apple Event Manager attempts to
coerce it into this type. If the value of desiredType is typeWildCard, no
coercion is performed, and the descriptor type of the resulting data is the same
as the descriptor type of the original descriptor record.
If you are getting data from a list of keyword-specified descriptor records,
the keyword of the specified descriptor record is returned in the parameter
theAEKeyword; otherwise, the value typeWildCard is returned.
The returned data's descriptor type is returned in the typeCode parameter.
The dataPtr parameter is the pointer to the buffer for storing the data.
The maximumSize parameter is the maximum length, in bytes, of the data to
be returned.
The AEGetNthPtr function returns in the actualSize parameter the actual
length, in bytes, of the data for the descriptor record. If this value is larger
than the value of maximumSize, not all of the data for the descriptor record
was returned.
For an example program showing use of AEGetNthPtr, see the description of
Open Documents Event.
Result codes
noErr (0) No error
memFullErr (-108) Not enough room in heap zone
errAECoercionFail (-1700) Data could not be coerced to descriptor type
errAEDescNotFound (-1701) Descriptor record was not found
errAEWrongDataType (-1703) Wrong descriptor type
errAENotAEDesc (-1704) Not a valid descriptor record
errAEReplyNotArrived (-1718) Reply has not yet arrived