Contents

AECreateDesc(_:_:_:_:)

Creates a new descriptor that incorporates the specified data.

Declaration

func AECreateDesc(_ typeCode: DescType, _ dataPtr: UnsafeRawPointer!, _ dataSize: Size, _ result: UnsafeMutablePointer<AEDesc>!) -> OSErr

Parameters

  • typeCode:

    The descriptor type for the new descriptor. For a list of AppleScript’s predefined descriptor types, see 1542788 Descriptor_type_constants. See Desctype.

  • dataPtr:

    A pointer to the data for the new descriptor. This data is copied into a newly-allocated block of memory for the descriptor that is created. To minimize copying overhead, consider using 1446239 Aecreatedescfromexternalptr.

  • dataSize:

    The length, in bytes, of the data for the new descriptor.

  • result:

    A pointer to a descriptor. On successful return, a descriptor that incorporates the data specified by the dataPtr parameter. On error, a null descriptor. If the function returns successfully, your application should call the 1444208 Aedisposedesc function to dispose of the resulting descriptor after it has finished using it. See Aedesc.

Return Value

A result code. See Result Codes.

Discussion

While it is possible to create an Apple event descriptor or a descriptor list or a descriptor with the AECreateDesc function (assuming you have access to the raw data for an Apple event, list, or descriptor), you typically create these structured objects with their specific creation routines—AECreateAppleEvent, AECreateList, or AECreateDesc.

Version-Notes

Thread safe starting in OS X v10.2.

See Also

Creating and Duplicating Descriptors