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

# resumeExecution(withResult:)

If a successful, unmatched, invocation of [`suspendExecution()`](/documentation/Foundation/NSScriptCommand/suspendExecution()) has been made, resume the execution of the command.

```
func resumeExecution(withResult result: Any?)
```

## Discussion

Resumes the execution of the command if a successful, unmatched, invocation of [`suspendExecution()`](/documentation/Foundation/NSScriptCommand/suspendExecution()) has been made—otherwise, does nothing. The value for `result` is dependent on the segment of command execution that was suspended:

- If [`suspendExecution()`](/documentation/Foundation/NSScriptCommand/suspendExecution()) was invoked from within a command handler of one of the command’s receivers, `result` is considered to be the return value of the handler. Unless the command has received a [`scriptErrorNumber`](/documentation/Foundation/NSScriptCommand/scriptErrorNumber) message with a nonzero error number, execution of the command will continue and the command handlers of other receivers will be invoked.
- If [`suspendExecution()`](/documentation/Foundation/NSScriptCommand/suspendExecution()) was invoked from within an override of [`performDefaultImplementation()`](/documentation/Foundation/NSScriptCommand/performDefaultImplementation()) the result is treated as if it were the return value of the invocation of [`performDefaultImplementation()`](/documentation/Foundation/NSScriptCommand/performDefaultImplementation()).

[`resumeExecution(withResult:)`](/documentation/Foundation/NSScriptCommand/resumeExecution(withResult:)) may be invoked in any thread, not just the one in which the corresponding invocation of [`suspendExecution()`](/documentation/Foundation/NSScriptCommand/suspendExecution()) occurred.

> Important:
> The script command handler that is being executed when ``doc://com.apple.foundation/documentation/Foundation/NSScriptCommand/suspendExecution()`` is invoked must return before you invoke ``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.

---

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)