<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSScriptObjectSpecifier/init(descriptor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSScriptObjectSpecifier(cm)objectSpecifierWithDescriptor:"
  },
  "title" : "init(descriptor:)"
}
-->

# init(descriptor:)

Returns a new object specifier for an Apple event descriptor.

```
init?(descriptor: NSAppleEventDescriptor)
```

## Parameters

`descriptor`

An Apple event descriptor. The descriptor must have the type `typeObjectSpecifier`.

## Return Value

An object specifier, or `nil` if an error occurs.

## Discussion

If `objectSpecifierWithDescriptor:` is invoked and fails during the execution of a script command, information about the error that caused the failure is recorded in `[NSScriptCommand currentCommand]`.

## See Also

  [Cocoa Scripting Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_intro/SAppsIntro.html#//apple_ref/doc/uid/TP40002164)



---

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)