Platforms to show: All Mac Windows Linux Cross-Platform

LaunchServicesOpenXMBS(documents() as folderitem, parameter as LaunchServicesLaunchParameterMBS) as folderitem

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method Launch Services MBS MacOSX Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Opens an application or one or more documents or folders.
Example
// Open a file in Preview (Mac OS X).
Sub OpenWithPreview(f as folderitem)
dim p as FolderItem
dim d(0) as FolderItem
dim r as FolderItem
dim param as LaunchServicesLaunchParameterMBS

// Find preview
p=LaunchServicesFindApplicationForInfoMBS("prvw","com.apple.Preview","Preview.app")

if p<>Nil then
d(0)=f

param=new LaunchServicesLaunchParameterMBS
param.Application=p
param.Defaults=true // just default settings

r=LaunchServicesOpenXMBS(d, param)
if r<>nil then
Return //Success
end if
end if

// On failure, just launch normally:
f.Launch true
End Sub

Opens applications, documents, and folders. Applications are opened via an 'oapp' or 'rapp' event. Documents are opened in their user-overridden or default applications as appropriate. Folders are opened in the Finder.

Returns a folderitem to the application which was launched.
Currently this function is not available to RB versions before 3.5.
Note that the documents parameter is an array of folderitem and not just one.

Upgraded in version 19.5 to use CFURL instead of FSRef APIs.

Some FAQ entries about this method:

Blog Entries

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


The biggest plugin in space...