---
title: "applicationWithProcessIdentifier:"
framework: Scripting Bridge
role: symbol
role_heading: Type Method
platforms: [Mac Catalyst 13.0+, macOS 10.5+]
path: "scriptingbridge/sbapplication/applicationwithprocessidentifier:"
---

# applicationWithProcessIdentifier:

Returns the shared instance representing a target application specified by its process identifier.

## Declaration

```occ
+ (SBApplication *) applicationWithProcessIdentifier:(pid_t) pid;
```

## Parameters

- `pid`: The BSD process ID of a OSA-compliant application. Often you can get the process ID of a process using the doc://com.apple.documentation/documentation/Foundation/Process/processIdentifier method of NSTask.

## Return Value

Return Value An instance of an SBApplication subclass that represents the target application whose process identifier is pid. Returns nil if no such application can be found or if the application does not have a scripting interface.

## Discussion

Discussion You should avoid using this method unless you know nothing about a target application but its process ID. In most cases, it is better to use applicationWithBundleIdentifier:, which will dynamically locate the application’s path at runtime, or applicationWithURL:, which is not dependent on the target application being open at the time the method is called.

## See Also

### Related Documentation

- [init(processIdentifier:)](scriptingbridge/sbapplication/init(processidentifier:).md)

### Getting a Scriptable Application Instance

- [applicationWithBundleIdentifier:](scriptingbridge/sbapplication/applicationwithbundleidentifier:.md)
- [applicationWithURL:](scriptingbridge/sbapplication/applicationwithurl:.md)
