<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSScriptCommandDescription/appleEventCodeForArgument(withName:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSScriptCommandDescription(im)appleEventCodeForArgumentWithName:"
  },
  "title" : "appleEventCodeForArgument(withName:)"
}
-->

# appleEventCodeForArgument(withName:)

Returns the Apple event code for the specified command argument of the receiver.

```
func appleEventCodeForArgument(withName argumentName: String) -> FourCharCode
```

## Parameters

`argumentName`

The argument name (used as a key) for which to obtain the corresponding Apple event code.

## Return Value

The code for the specified argument.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)