Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSRunningApplicationMBS class.

NSRunningApplicationMBS.currentApplication as NSRunningApplicationMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Process MBS MacCocoa Plugin 9.7 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns an NSRunningApplication representing this application.
Example
dim n as NSRunningApplicationMBS = NSRunningApplicationMBS.currentApplication

MsgBox n.localizedName

Available in Mac OS X v10.6 and later.

NSRunningApplicationMBS.runningApplications as NSRunningApplicationMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Process MBS MacCocoa Plugin 9.7 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns an array of NSRunningApplication representing the running applications.
Example
dim n(-1) as NSRunningApplicationMBS = NSRunningApplicationMBS.runningApplications
dim s(-1) as string

for each r as NSRunningApplicationMBS in n
s.Append r.localizedName
next

MsgBox Join(s,EndOfLine)

Returns an array of NSRunningApplication instances.

The order of the array is unspecified, but it is stable, meaning that the relative order of particular applications will not change across multiple calls to runningApplications. See NSRunningApplication Class Reference for more information on NSRunningApplication.
Similar to the NSRunningApplication classes's properties, this property will only change when the main run loop is run in a common mode. Instead of polling, use key-value observing to be notified of changes to this array property.
This property is thread safe, in that it may be called from background threads and the result is returned atomically.

This list is not updated in a tight loop. For receiving updates, you need to have the runloop run (e.g. check regularly in a timer).

Some examples using this method:

NSRunningApplicationMBS.runningApplicationsWithBundleIdentifier(bundleID as string) as NSRunningApplicationMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Process MBS MacCocoa Plugin 9.7 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns an array of currently running applications with the specified bundle identifier.
Example
dim n(-1) as NSRunningApplicationMBS = NSRunningApplicationMBS.runningApplicationsWithBundleIdentifier("com.apple.iTunes")

if UBound(n)>=0 then
MsgBox n(0).localizedName
else
MsgBox "iTunes is not running?"
end if

An array of NSRunningApplications, or an empty array if no applications match the bundle identifier.
Available in Mac OS X v10.6 and later.

Some examples using this method:

NSRunningApplicationMBS.runningApplicationWithProcessIdentifier(pid as Integer) as NSRunningApplicationMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Process MBS MacCocoa Plugin 9.7 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the running application with the given process identifier, or nil if no application has that pid.
Example
dim n as NSRunningApplicationMBS
dim pid as Integer

while n=nil
pid=pid+1
n=NSRunningApplicationMBS.runningApplicationWithProcessIdentifier(pid)
wend

MsgBox n.localizedName+" has PID "+str(pid)

pid: The process identifier.

Returns an instance of NSRunningApplication for the specified pid, or nil if the application has no process identifier.

Applications that do not have PIDs cannot be returned from this method.
Available in Mac OS X v10.6 and later.

The items on this page are in the following plugins: MBS MacCocoa Plugin.


The biggest plugin in space...