---
title: "AEReplaceDescData(_:_:_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1446695-aereplacedescdata
---

# AEReplaceDescData(_:_:_:_:)

Copies the specified data into the specified descriptor, replacing any previous data.

## Declaration

```swift
func AEReplaceDescData(_ typeCode: DescType, _ dataPtr: UnsafeRawPointer!, _ dataSize: Size, _ theAEDesc: UnsafeMutablePointer<AEDesc>!) -> OSErr
```

## Parameters

- `typeCode`: Specifies the descriptor type of the data pointed to by dataPtr. For a list of AppleScript’s predefined descriptor types, see doc://com.apple.documentation/documentation/coreservices/apple_events/1542788-descriptor_type_constants. See doc://com.apple.documentation/documentation/coreservices/desctype.
- `dataPtr`: A pointer to the data to store in the specified descriptor.
- `dataSize`: The size, in bytes, of the data pointed to by the dataSize parameter.
- `theAEDesc`: A pointer to a descriptor. On return, contains the copied data. See doc://com.apple.documentation/documentation/coreservices/aedesc.

## Return Value

Return Value A result code. See Result Codes.

## Discussion

Discussion Thread safe starting in OS X v10.2.

## See Also

### Operating On Descriptor Data

- [AEGetDescData(_:_:_:)](coreservices/1444427-aegetdescdata.md)
- [AEGetDescDataSize(_:)](coreservices/1450119-aegetdescdatasize.md)
- [AEGetDescDataRange(_:_:_:_:)](coreservices/1446560-aegetdescdatarange.md)
