Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSWorkspaceMBS class.
NSWorkspaceMBS.absolutePathForAppBundleWithIdentifier(bundleIdentifier as string) as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 12.5 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
bundleIdentifier: The bundle identifier string. This value corresponds to the value in the CFBundleIdentifier key of the application's Info.plist file. For example, the bundle identifier of the TextEdit application is com.apple.TextEdit.
Returns the file system path to the application bundle identified by bundleIdentifier, or "" if the bundle cannot be found.
NSWorkspaceMBS.activateFileViewerSelectingFiles(Files() as folderitem)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Available in Mac OS X v10.6 and later.
NSWorkspaceMBS.activateFileViewerSelectingURLs(URLs() as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Available in Mac OS X v10.6 and later.
NSWorkspaceMBS.desktopImageOptionsForScreen(screen as NSScreenMBS) as dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
screen: The screen for which to get the desktop image options.
Returns a dictionary containing key-value pairs. Keys can be NSWorkspaceDesktopImageScalingKey, NSWorkspaceDesktopImageAllowClippingKey or NSWorkspaceDesktopImageFillColorKey.
Available in Mac OS X v10.6 and later.
NSWorkspaceMBS.desktopImageURLForScreen(screen as NSScreenMBS) as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
screen: The screen for which to get the desktop image.
Returns the desktop image.
Available in Mac OS X v10.6 and later.
NSWorkspaceMBS.fileLabelColors as NSColorMBS()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
This array has the same number of elements as fileLabels, and the color at a given index corresponds to the label at the same index.
You can listen for notifications named NSWorkspaceDidChangeFileLabelsNotification to be notified when file labels change which may result in changes to the order of the fileLabelColors.
Available in Mac OS X v10.6 and later.
NSWorkspaceMBS.fileLabels as string()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
You can listen for notifications named NSWorkspaceDidChangeFileLabelsNotification to be notified when file labels change.
Available in Mac OS X v10.6 and later.
NSWorkspaceMBS.findApplications
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 8.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSWorkspaceMBS.frontmostApplication as NSRunningApplicationMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Requires Mac OS X 10.7.
NSWorkspaceMBS.fullPathForApplication(appname as string) as folderitem
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 8.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The full path for the application, or nil if the specified application was not found.
NSWorkspaceMBS.hideOtherApplications
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 8.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The user can hide all applications except the current one by Command-Option-clicking on an application's Dock icon.
NSWorkspaceMBS.iconForFile(file as folderitem) as NSImageMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 8.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The returned image has an initial size of 32 pixels by 32 pixels.
Returns nil on any error.
Some examples using this method:
NSWorkspaceMBS.iconForFiles(files() as folderitem) as NSImageMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
files: An array of folderitems, each of which contains the full path to a file.
Returns the icon associated with the group of files.
If fullPaths specifies one file, that file's icon is returned. If fullPaths specifies more than one file, an icon representing the multiple selection is returned.
NSWorkspaceMBS.iconForFileType(filetype as string) as NSImageMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 8.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
filetype: The file type, which may be either a filename extension or an encoded HFS file type.
The returned image has an initial size of 32 pixels by 32 pixels.
Returns nil on any error.
Running this in a thread can lead to crashes.
Some examples using this method:
NSWorkspaceMBS.isFilePackageAtPath(item as folderitem) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Returns true if the path identifies a file package; otherwise, false if the path does not exist, is not a directory, or is not a file package.
NSWorkspaceMBS.launchApplication(appname as string) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 8.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Returns true if the application was successfully launched or was already running; otherwise, false.
The appName parameter need not be specified with a full path and, in the case of an application wrapper, may be specified with or without the .app extension, as described in "Use of .app Extension".
See also:
NSWorkspaceMBS.launchApplication(appname as string, showicon as boolean, autolaunch as boolean) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 8.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
appName: The name of the application to open.
showIcon: If false, the application's icon is not placed on the screen. (The icon still exists, though.)
autolaunch: If true, the autolaunch default is set as though the specified application were autolaunched at startup.
This method is provided to enable daemon-like applications that lack a normal user interface. Its use is not generally encouraged.
Returns true if the application is successfully launched or already running, and false if it can't be launched.
See also:
NSWorkspaceMBS.launchApplicationAtFile(file as folderitem, options as UInt32 = 0, configuration as dictionary = nil) as NSRunningApplicationMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
file: The application folderitem.
options: Options to use when launching the application. see NSWorkspaceLaunch* constants.
configuration: A dictionary containing the configuration options. Possible key-value pairs are described NSWorkspaceLaunchConfiguration* functions.
error: The error is returned here.
Returns reference to newly started application.
Available in Mac OS X v10.6 and later.
See also:
NSWorkspaceMBS.launchApplicationAtFile(file as folderitem, options as UInt32, configuration as dictionary, byref error as NSErrorMBS) as NSRunningApplicationMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
file: The application folderitem.
options: Options to use when launching the application. see NSWorkspaceLaunch* constants.
configuration: A dictionary containing the configuration options. Possible key-value pairs are described NSWorkspaceLaunchConfiguration* functions.
error: The error is returned here.
Returns reference to newly started application.
Available in Mac OS X v10.6 and later.
See also:
NSWorkspaceMBS.launchApplicationAtURL(URL as string, options as UInt32 = 0, configuration as dictionary = nil) as NSRunningApplicationMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
url: The application URL.
options: Options to use when launching the application. see NSWorkspaceLaunch* constants.
configuration: A dictionary containing the configuration options. Possible key-value pairs are described NSWorkspaceLaunchConfiguration* functions.
error: The error is returned here.
Returns reference to newly started application.
Available in Mac OS X v10.6 and later.
See also:
NSWorkspaceMBS.launchApplicationAtURL(URL as string, options as UInt32, configuration as dictionary, byref error as NSErrorMBS) as NSRunningApplicationMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
url: The application URL.
options: Options to use when launching the application. see NSWorkspaceLaunch* constants.
configuration: A dictionary containing the configuration options. Possible key-value pairs are described NSWorkspaceLaunchConfiguration* functions.
error: The error is returned here.
Returns reference to newly started application.
Available in Mac OS X v10.6 and later.
See also:
NSWorkspaceMBS.launchAppWithBundleIdentifier(bundleIdentifier as string, options as Integer = &h00030000, AppleEventDescriptor as Variant = nil) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 12.5 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
bundleIdentifier: A bundle identifier string. This value corresponds to the value in the CFBundleIdentifier key of the application's Info.plist file. For example, the bundle identifier of the TextEdit application is com.apple.TextEdit.
options: Options to use when launching the application. Values for this parameter are described in constants.
descriptor: Additional options specified in an AppleEvent-style descriptor. For example, you could use this parameter to specify additional documents to open when the application is launched.
Returns true if the application was found and launched; otherwise, false.
NSWorkspaceMBS.localizedDescriptionForType(typeName as string) as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The localized description is suitable for displaying to the user.
Available in Mac OS X v10.5 and later.
NSWorkspaceMBS.menuBarOwningApplication as NSRunningApplicationMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Requires Mac OS X 10.7.
NSWorkspaceMBS.mountedLocalVolumePaths as string()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Returns an array of strings, each of which contains the full pathname of the mount point for any local volumes.
NSWorkspaceMBS.mountedRemovableMedia as string()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Returns an array of strings, each of which contains the full pathname of a mounted removable disk.
If the computer provides an interrupt or other notification when the user inserts a disk into a drive, the Finder will mount the disk immediately. However, if no notification is given, the Finder won't be aware that a disk needs to be mounted. On such systems, an application should invoke either mountNewRemovableMedia or checkForRemovableMedia before invoking mountedRemovableMedia. Either of these methods cause the Finder to poll the drives to see if a disk is present. If a disk has been inserted but not yet mounted, these methods will cause the Finder to mount it.
The Disk button in an Open or Save panel invokes mountedRemovableMedia and mountNewRemovableMedia as part of its operation, so most applications won't need to invoke these methods directly.
NSWorkspaceMBS.noteFileSystemChanged
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The NSWorkspace object then gets the status of all the files and directories it is interested in and updates itself appropriately. This method is used by many objects that write or delete files.
The NSDocument and NSSavePanel objects use this method when saving a file. If you create a file directly, you should call noteFileSystemChanged so that the Finder can update the folder if it is open.
Available in Mac OS X v10.0 and later. Deprecated in Mac OS X v10.6.
See also:
NSWorkspaceMBS.noteFileSystemChanged(path as folderitem)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The NSWorkspace object then gets the status of all the files and directories it is interested in and updates itself appropriately. This method is used by many objects that write or delete files.
See also:
NSWorkspaceMBS.notificationCenter as NSNotificationCenterMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 9.7 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSWorkspaceMBS.NSWorkspaceActiveSpaceDidChangeNotification as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Posted when a Spaces change has occurred.
The notification object is the shared NSWorkspace instance. The notification does not contain a userInfo dictionary.
Available in Mac OS X v10.6 and later.
Some examples using this method:
NSWorkspaceMBS.NSWorkspaceApplicationKey as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The value corresponding to this key is an instance of NSRunningApplication that reflects the affected application.
Available in Mac OS X v10.6 and later.
NSWorkspaceMBS.NSWorkspaceCompressOperation as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Compress file. This operation always returns an error.
NSWorkspaceMBS.NSWorkspaceCopyOperation as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Copy file to destination.
NSWorkspaceMBS.NSWorkspaceDecompressOperation as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Decompress file. This operation always returns an error.
NSWorkspaceMBS.NSWorkspaceDecryptOperation as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Decrypt file. This operation always returns an error.
NSWorkspaceMBS.NSWorkspaceDesktopImageAllowClippingKey as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The value is a boolean, which affects the interpretation of Proportional scaling types. A false value will make the image fully visible, but there may be empty space on the sides or top and bottom. A true value will cause the image to fill the entire screen, but the image may be clipped. If this is not specified, false is assumed. Non-proportional scaling types ignore this value.
Available in Mac OS X v10.6 and later.
NSWorkspaceMBS.NSWorkspaceDesktopImageFillColorKey as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
shared method | Cocoa | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
The value is an NSColor, which is used to fill any empty space around the image. If not specified, a default value is used. Currently, only colors that use or can be converted to use NSCalibratedRGBColorSpace are supported, and any alpha value is ignored.
Available in Mac OS X v10.6 and later.
The items on this page are in the following plugins: MBS MacCocoa Plugin.
