---
title: suspendExecution()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/nsscriptcommand/suspendexecution()
---

# suspendExecution()

Suspends the execution of the receiver.

## Declaration

```swift
func suspendExecution()
```

## Discussion

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:) must be made. important: The script command handler that is being executed when this method is invoked must return before the subsequent invocation of 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.

## See Also

### Suspending and resuming commands

- [resumeExecution(withResult:)](foundation/nsscriptcommand/resumeexecution(withresult:).md)
