Type Method

applicationWithProcessIdentifier:

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

Declaration

+ (__kindof 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 processIdentifier method of NSTask.

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

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

Getting a Scriptable Application Instance

+ applicationWithBundleIdentifier:

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

+ applicationWithURL:

Returns the shared instance representing a target application specified by the given URL.