Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

LaunchServicesAllHandlersForURLSchemeMBS(URLScheme as string) as LaunchServicesStringListMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 6.1 Yes No No Yes, macOS only No
Function: Returns an array of application bundle identifiers for applications capable of handling the specified URL scheme.
Example:
dim l as LaunchServicesStringListMBS
dim s(-1) as string
dim i,c as Integer

l=LaunchServicesAllHandlersForURLSchemeMBS("http")
if l<>nil then
c=l.Count-1
for i=0 to c
s.Append l.Item(i)
next

MsgBox Join(s,", ")
end if
Notes:
URL handling capability is determined according to the kCFBundleURLTypes listed in an application's Info.plist).
Returns nil if no handlers are available.

Example output from the code above:
org.videolan.vlc, com.RealNetworks.RealPlayer, org.mozilla.firefox, com.apple.safari, de.icab.iCab, com.microsoft.explorer

Requires Mac OS X 10.4 to work correct. Returns always nil on older systems.

Feedback, Comments & Corrections

LaunchServicesAllRoleHandlersForContentTypeMBS(ContentType as string, role as Integer) as LaunchServicesStringListMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 6.0 Yes No No Yes, macOS only No
Function: Returns an array of application bundle identifiers for applications capable of handling the specified content type (UTI) with the specified role(s).
Example:
dim l as LaunchServicesStringListMBS
dim s(-1) as string
dim i,c as Integer

const kLSRolesAll=-1

l=LaunchServicesAllRoleHandlersForContentTypeMBS("com.adobe.pdf",kLSRolesAll)
if l<>nil then
c=l.Count-1
for i=0 to c
s.Append l.Item(i)
next

MsgBox Join(s,", ")
end if
Notes:
Application content handling capabilities are determined according to the kCFBundleDocumentTypes listed in an application's Info.plist). For any role, specify kLSRolesAll.
Returns nil if no handlers are available.
Requires Mac OS X 10.4.

Constants you can use for the role parameter:
kLSRolesNone = 1no claim is made about support for this type/scheme
kLSRolesViewer= 2claim to be able to view this type/scheme
kLSRolesEditor= 4claim to be able to edit this type/scheme
kLSRolesAll = -1claim to do it all

Example output for code above is:
com.adobe.Reader, com.apple.preview, com.adobe.acrobat.reader, com.apple.MDIimporter.PDF

Feedback, Comments & Corrections

LaunchServicesApplicationForInfoMBS(type as string, creator as string, extension as string, role as Integer) as folderitem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: Return the application used to open items with particular data.
Example:
MsgBox LaunchServicesApplicationForInfoMBS("","R*ch","txt",-1).name
MsgBox LaunchServicesApplicationForInfoMBS("TEXT","","",-1).name
MsgBox LaunchServicesApplicationForInfoMBS("","","txt",-1).name
Notes:
Consults the binding tables to return the application that would be used to open items with type, creator, and/or extension as provided if they were double-clicked in the Finder. This application will be the default for items like this if one has been set. If no application is known to LaunchServices suitable for opening such items, nil (kLSApplicationNotFoundErr) will be returned. Not all three input parameters can be "" at the same time nor can both output parameters be "" at the same time.

Constants you can use for the role parameter:
kLSRolesNone = 1no claim is made about support for this type/scheme
kLSRolesViewer= 2claim to be able to view this type/scheme
kLSRolesEditor= 4claim to be able to edit this type/scheme
kLSRolesAll = -1claim to do it all

Feedback, Comments & Corrections

LaunchServicesApplicationForItemMBS(file as folderitem, role as Integer) as folderitem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: Return the application used to open an item.
Example:
dim file,appf as FolderItem

file=SpecialFolder.Desktop.Child("d.rb") // some Realbasic file
appf=LaunchServicesApplicationForItemMBS(file, 0)

MsgBox appf.AbsolutePath
Notes:
Consults the binding tables to return the application that would be used to open the folderitem if it were double-clicked in the Finder. This application will be the user-specified override if appropriate or the default otherwise. If no application is known to LaunchServices suitable for opening this item, nil (kLSApplicationNotFoundErr) will be returned.

Constants you can use for the role parameter:
kLSRolesNone = 1no claim is made about support for this type/scheme
kLSRolesViewer= 2claim to be able to view this type/scheme
kLSRolesEditor= 4claim to be able to edit this type/scheme
kLSRolesAll = -1claim to do it all

Feedback, Comments & Corrections

LaunchServicesCanApplicationAcceptItemMBS(item as folderitem, targetapp as folderitem, role as Integer, flags as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: Determine whether an item can accept another item.
Notes:
Returns whether TargetApp can accept this folderitem as in a drag and drop operation. If role is other than kLSRolesAll then make sure TargetApp claims to fulfill the requested role.

Constants you can use for the role parameter:
kLSRolesNone = 1no claim is made about support for this type/scheme
kLSRolesViewer= 2claim to be able to view this type/scheme
kLSRolesEditor= 4claim to be able to edit this type/scheme
kLSRolesAll = -1claim to do it all

Values for the flags:
kLSAcceptDefault = 1
kLSAcceptAllowLoginUI= 2show UI to log in if necessary

Feedback, Comments & Corrections

LaunchServicesDefaultHandlerForURLSchemeMBS(URLScheme as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 6.1 Yes No No Yes, macOS only No
Function: Returns the bundle identifier of the default handler for the specified URL scheme.
Example:
MsgBox LaunchServicesDefaultHandlerForURLSchemeMBS("http") // shows here: com.apple.safari
Notes:
Returns "" if no handler is available.
Requires Mac OS X 10.4 to work correct. Returns always "" on older systems.

Feedback, Comments & Corrections

LaunchServicesDefaultRoleHandlerForContentTypeMBS(ContentType as string, role as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 6.0 Yes No No Yes, macOS only No
Function: Returns the application bundle identifier of the default handler for the specified content type (UTI), in the specified role(s).
Example:
const type="com.adobe.pdf"
msgbox LaunchServicesDefaultRoleHandlerForContentTypeMBS(type,-1)
Notes:
For any role, specify kLSRolesAll. Returns "" if no handler is available.
Requires Mac OS X 10.4.

Constants you can use for the role parameter:
kLSRolesNone = 1no claim is made about support for this type/scheme
kLSRolesViewer= 2claim to be able to view this type/scheme
kLSRolesEditor= 4claim to be able to edit this type/scheme
kLSRolesAll = -1claim to do it all

Feedback, Comments & Corrections

LaunchServicesDisplayNameForCFURLMBS(cfurlhandle as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: Get the display name for an url handle.
Notes:
Return a copy of the display name for an url handle. Takes into consideration whether this item has a hidden extension or not.

Cfurlhandle should be the non 0 value from a CFURL object handle property.

Feedback, Comments & Corrections

LaunchServicesFindApplicationForInfoMBS(creator as string, bundleID as string, name as string) as folderitem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: Locate a specific application.
Example:
MsgBox LaunchServicesFindApplicationForInfoMBS("prvw","","").Name
MsgBox LaunchServicesFindApplicationForInfoMBS("","com.apple.iTunes","").Name
MsgBox LaunchServicesFindApplicationForInfoMBS("","","Safari.app").Name
Notes:
Returns the application with the corresponding input information. The registry of applications is consulted first in order of bundleID, then creator, then name. All comparisons are case insensitive and 'ties' are decided first by version, then by native vs. Classic.

Parameters can be "". The name of the application must be the name with the extension.

Some examples using this method:

Some FAQ entries about this method:

Feedback, Comments & Corrections

LaunchServicesItemInfoForCFURLMBS(cfurlhandle as Integer, WhichInfo as Integer) as LaunchServicesItemInfoMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: Return information about an item.
Notes:
Returns as much or as little information as requested about the url. Some information is available in a thread-safe manner, some is not.

Cfurlhandle should be the non 0 value from a CFURL object handle property.

Possible values you can combine for the WhichInfo parameter:
kLSRequestExtension = &h01Requests the item's filename extension.
kLSRequestTypeCreator = &h02Requests the item's file type and creator signature.
kLSRequestBasicFlagsOnly = &h04Requests all item-information flags that are not application-specific: that is, all except IsNativeApp, IsClassicApp, AppPrefersNative, AppPrefersClassic and AppIsScriptable.
kLSRequestAppTypeFlags = &h08Requests all application-specific item-information flags: that is, IsNativeApp, IsClassicApp, AppPrefersNative, AppPrefersClassic and AppIsScriptable.
kLSRequestAllFlags = &h10Requests all item-information flags.
kLSRequestIconAndKind = &h20Not used.
kLSRequestExtensionFlagsOnly= &h40Requests only the kLSItemInfoExtensionIsHidden item-information flag.
kLSRequestAllInfo = -1

Feedback, Comments & Corrections

LaunchServicesKindStringForCFURLMBS(cfurlhandle as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: Get the kind string for an item.
Notes:
Returns the kind string as used in the Finder and elsewhere for the given folderitem.

Cfurlhandle should be the non 0 value from a CFURL object handle property.

Feedback, Comments & Corrections

LaunchServicesOpenMBS(item as folderitem) as folderitem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: Open an application, document, or folder.
Notes:
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. Use the more specific LaunchServicesOpenXMBS for more control over launching.

Returns a folderitem to the application which was launched.

Feedback, Comments & Corrections

LaunchServicesOpenXMBS(documents() as folderitem, parameter as LaunchServicesLaunchParameterMBS) as folderitem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: 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
Notes:
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.

Some FAQ entries about this method:

Feedback, Comments & Corrections

LaunchServicesSetDefaultHandlerForURLSchemeMBS(URLScheme as string, BundleID as string) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 6.1 Yes No No Yes, macOS only No
Function: Sets the user's preferred handler for the specified URL scheme.
Example:
dim e as Integer
dim old as string

old=LaunchServicesDefaultHandlerForURLSchemeMBS("http")

MsgBox "Before: "+old

e=LaunchServicesSetDefaultHandlerForURLSchemeMBS("http","com.microsoft.explorer")

MsgBox "LaunchServicesSetDefaultHandlerForURLSchemeMBS: "+str(e)

MsgBox "Between: "+LaunchServicesDefaultHandlerForURLSchemeMBS("http")

e=LaunchServicesSetDefaultHandlerForURLSchemeMBS("http",old)

MsgBox "LaunchServicesSetDefaultHandlerForURLSchemeMBS: "+str(e)

MsgBox "After: "+LaunchServicesDefaultHandlerForURLSchemeMBS("http")
Notes:
Returns Mac OS error code with 0 for success.
The handler is specified as an application bundle identifier.
Requires Mac OS X 10.4 to work correct. Returns always -1 on older systems.

Feedback, Comments & Corrections

LaunchServicesSetDefaultRoleHandlerForContentTypeMBS(ContentType as string, role as Integer, BundleID as string) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Launch Services MBS MacOSX Plugin 6.0 Yes No No Yes, macOS only No
Function: Sets the user's preferred handler for the specified content type (UTI) in the specified role(s).
Example:
dim e as Integer

// makes Acrobat the default pdf reader
'e=LaunchServicesSetDefaultRoleHandlerForContentTypeMBS("com.adobe.pdf",-1,"com.adobe.Reader")

// makes preview the default pdf reader
e=LaunchServicesSetDefaultRoleHandlerForContentTypeMBS("com.adobe.pdf",-1,"com.apple.preview")

msgbox str(e)
Notes:
For all roles, specify kLSRolesAll. The handler is specified as an application bundle identifier.
Returns a Mac OS error code or -1 if the function is not available.
Requires Mac OS X 10.4.

Constants you can use for the role parameter:
kLSRolesNone = 1no claim is made about support for this type/scheme
kLSRolesViewer= 2claim to be able to view this type/scheme
kLSRolesEditor= 4claim to be able to edit this type/scheme
kLSRolesAll = -1claim to do it all

Feedback, Comments & Corrections

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





Links
MBS FileMaker Plugins