<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWindow/handlePrint(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSWindow(im)handlePrintScriptCommand:"
  },
  "title" : "handlePrint(_:)"
}
-->

# handlePrint(_:)

Handles the AppleScript command to print the contents of the window (or its associated document, if any).

```
func handlePrint(_ command: NSScriptCommand) -> Any?
```

## Discussion

If there’s a corresponding document and the window is the main window of the document, it forwards the `print` command to the corresponding document. Otherwise, the window sends itself a `print` message.

---

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)