|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||Process||MBS MacCocoa Plugin||9.7||Yes||No||No||Yes, macOS only||No|
dim n as new NSRunningApplicationMBS
Only user applications are tracked; this does not provide information about every process on the system.
Some properties of an application are fixed, such as the bundle identifier. Other properties may vary over time, such as whether the app is hidden. Properties that vary can be observed with key-value observing, in which case the description comment for the method notes this capability.
Properties that vary over time are inherently race-prone. For example, a hidden app may unhide itself at any time. To ameliorate this, properties persist until the next turn of the main run loop in a common mode. For example, if you repeatedly poll an unhidden app for its hidden property without allowing the run loop to run, it will continue to return false, even if the app hides, until the next turn of the run loop.
NSRunningApplication is thread safe, in that its properties are returned atomically. However, it is still subject to the main run loop policy described above. If you access an instance of NSRunningApplication from a background thread, be aware that its time-varying properties may change from under you as the main run loop runs (or not).
An NSRunningApplication instance remains valid after the application exits. However, most properties lose their significance, and some properties may not be available on a terminated application.
Requires Mac OS X 10.6.
- 15 properties
- property activationPolicy as Integer
- property active as boolean
- property bundleIdentifier as string
- property bundleURL as string
- property executableArchitecture as Integer
- property executableURL as string
- property finishedLaunching as boolean
- property Handle as Integer
- property hidden as boolean
- property icon as NSImageMBS
- property launchDate as date
- property localizedName as string
- property ownsMenuBar as boolean
- property processIdentifier as Integer
- property terminated as boolean
- 6 methods
- 4 shared methods
- shared method currentApplication as NSRunningApplicationMBS
- shared method runningApplications as NSRunningApplicationMBS()
- shared method runningApplicationsWithBundleIdentifier(bundleID as string) as NSRunningApplicationMBS()
- shared method runningApplicationWithProcessIdentifier(pid as Integer) as NSRunningApplicationMBS
- 5 constants
This class has no sub classes.
Some methods using this class:
- NSWorkspaceMBS.frontmostApplication as NSRunningApplicationMBS
- NSWorkspaceMBS.launchApplicationAtFile(file as folderitem, options as UInt32 = 0, configuration as dictionary = nil) as NSRunningApplicationMBS
- NSWorkspaceMBS.launchApplicationAtFile(file as folderitem, options as UInt32, configuration as dictionary, byref error as NSErrorMBS) as NSRunningApplicationMBS
- NSWorkspaceMBS.launchApplicationAtURL(URL as string, options as UInt32 = 0, configuration as dictionary = nil) as NSRunningApplicationMBS
- NSWorkspaceMBS.launchApplicationAtURL(URL as string, options as UInt32, configuration as dictionary, byref error as NSErrorMBS) as NSRunningApplicationMBS
- NSWorkspaceMBS.menuBarOwningApplication as NSRunningApplicationMBS
Some examples which use this class:
The items on this page are in the following plugins: MBS MacCocoa Plugin.
MBS FileMaker blog