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

# suspendExecution()

Suspends the execution of the receiver.

```
func suspendExecution()
```

## Discussion

Suspends the execution of the receiver only if the receiver is being executed in the current thread by Cocoa scripting’s built-in Apple event handling (that is, the receiver would be returned by `[NSScriptCommand currentCommand]`)—otherwise, does nothing. A matching invocation of [`resumeExecution(withResult:)`](/documentation/Foundation/NSScriptCommand/resumeExecution(withResult:)) must be made.

> Important:
> The script command handler that is being executed when this method is invoked must return before the subsequent invocation of ``doc://com.apple.foundation/documentation/Foundation/NSScriptCommand/resumeExecution(withResult:)``. That is, it is not valid to suspend a command’s execution and then resume it immediately.

Another command can execute while a command is suspended.

---

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)