---
title: "AEPutAttributePtr(_:_:_:_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1445940-aeputattributeptr
---

# AEPutAttributePtr(_:_:_:_:_:)

Adds a pointer to data, a descriptor type, and a keyword to an Apple event as an attribute.

## Declaration

```swift
func AEPutAttributePtr(_ theAppleEvent: UnsafeMutablePointer<AppleEvent>!, _ theAEKeyword: AEKeyword, _ typeCode: DescType, _ dataPtr: UnsafeRawPointer!, _ dataSize: Size) -> OSErr
```

## Parameters

- `theAppleEvent`: A pointer to the Apple event to add an attribute to. See the doc://com.apple.documentation/documentation/coreservices/appleevent data type.
- `theAEKeyword`: The keyword for the attribute to add. If the Apple event already includes an attribute with this keyword, the attribute is replaced. Some keyword constants are described in doc://com.apple.documentation/documentation/coreservices/apple_events/1542920-keyword_attribute_constants. See doc://com.apple.documentation/documentation/coreservices/aekeyword.
- `typeCode`: The descriptor type for the attribute to add. 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 for the attribute to add.
- `dataSize`: The length, in bytes, of the data for the attribute to add.

## Return Value

Return Value A result code. See Result Codes.

## Discussion

Discussion Thread safe starting in OS X v10.2.

## See Also

### Adding Parameters and Attributes to Apple Events and Apple Event Records

- [AEPutAttributeDesc(_:_:_:)](coreservices/1441790-aeputattributedesc.md)
- [AEPutParamDesc(_:_:_:)](coreservices/1447576-aeputparamdesc.md)
- [AEPutParamPtr(_:_:_:_:_:)](coreservices/1449263-aeputparamptr.md)
