<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSDocument/lastComponentOfFileName",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDocument(py)lastComponentOfFileName"
  },
  "title" : "lastComponentOfFileName"
}
-->

# lastComponentOfFileName

The name of the document seen by the user in AppleScript.

```
var lastComponentOfFileName: String { get set }
```

## Discussion

This property contains the document name used during scripting. Note that this name may be different than the name used in [`fileURL`](/documentation/AppKit/NSDocument/fileURL).

## See Also

[`displayName`](/documentation/AppKit/NSDocument/displayName)

The name of the document as displayed in the title bars of the document’s windows and in alert dialogs related to the document.



---

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)