Xojo Conferences
MBSOct2019CologneDE

Platforms to show: All Mac Windows Linux Cross-Platform

folderitem.isApplicationMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Launch Services MBS MacOSX Plugin 12.1 Yes No No Yes, macOS only No
Function: Whether the folderitem points to an application.
Example:
// try an application
dim file1 as FolderItem = SpecialFolder.Applications.Child("iTunes.app")
MsgBox "Bundle: "+str(file1.isBundleMBS)+EndOfLine+"Application: "+str(file1.isApplicationMBS)

// try some other file
dim file2 as FolderItem = SpecialFolder.Preferences.Child("com.apple.itunes.plist")
MsgBox "Bundle: "+str(file2.isBundleMBS)+EndOfLine+"Application: "+str(file2.isApplicationMBS)
Notes: Returns true if the folderitem points to an application on Mac.

Feedback, Comments & Corrections

folderitem.isBundleMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Launch Services MBS MacOSX Plugin 9.1 Yes No No Yes, macOS only No
Function: Whether the folderitem points to a bundle.
Example:
// try an application
dim file1 as FolderItem = SpecialFolder.Applications.Child("iTunes.app")
MsgBox "Bundle: "+str(file1.isBundleMBS)+EndOfLine+"Application: "+str(file1.isApplicationMBS)

// try some other file
dim file2 as FolderItem = SpecialFolder.Preferences.Child("com.apple.itunes.plist")
MsgBox "Bundle: "+str(file2.isBundleMBS)+EndOfLine+"Application: "+str(file2.isApplicationMBS)
Notes:
Returns true if the folderitem points to a directory which is a bundle/package.
For example an application package (.app).

Some examples which use this method:

Feedback, Comments & Corrections

folderitem.LaunchServicesApplicationForItemMBS(role as Integer) as folderitem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
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 f as FolderItem

f=GetFolderItem("itunes.tiff")

MsgBox f.LaunchServicesApplicationForItemMBS(-1).name
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

folderitem.LaunchServicesApplicationsForItemMBS(role as Integer) as LaunchServicesApplicationListMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Launch Services MBS MacOSX Plugin 3.4 Yes No No Yes, macOS only No
Function: Returns a list of folderitems to applications that offer the requested role(s) for the input item.
Example:
dim l as LaunchServicesApplicationListMBS
dim f as FolderItem

f=GetFolderItem("text file")
l=f.LaunchServicesApplicationsForItemMBS(4)

if l<>nil then
MsgBox str(l.Count)
MsgBox l.Item(0).NativePath
end if
Notes:
Requires Mac OS X 10.3.

If the folderitem is a file reference, it is treated as a document, and applications are selected based on the document's type information. Otherwise, applications are selected based on the folderitem's scheme.

Role:
The role(s) which must intersect with the role provided by an application for the specified item in order for the application to be included in the result. Pass kLSRolesAll if any role is acceptable.

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

folderitem.LaunchServicesCanApplicationAcceptItemMBS(TargetApp as folderitem, role as Integer, flags as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: Determine whether an item can accept another item.
Example:
dim appl,item as FolderItem

appl=LaunchServicesApplicationForInfoMBS("","","rb",-1)
item=GetFolderItem("file.rb")

MsgBox appl.Name

if item.LaunchServicesCanApplicationAcceptItemMBS(appl,-1,1) then
MsgBox "accept"
else
MsgBox "not accepted"
end if
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

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

Feedback, Comments & Corrections

folderitem.LaunchServicesItemInfoMBS(WhichInfo as Integer) as LaunchServicesItemInfoMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: Return information about an item.
Example:
dim l as LaunchServicesItemInfoMBS
dim f as FolderItem

f=SpecialFolder.Applications.Child("Mail.app")
l=f.LaunchServicesItemInfoMBS(-1)

if l.IsApplication then // True for mail.app
MsgBox "is Application"
end if

if l.IsContainer then // True for mail.app
MsgBox "is Container"
end if

if l.IsPackage then // True for mail.app
MsgBox "is Package"
end if
Notes:
Returns as much or as little information as requested about the folderitem. Some information is available in a thread-safe manner, some is not.

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

Some examples which use this method:

Feedback, Comments & Corrections

folderitem.LaunchServicesKindStringMBS as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
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.

Feedback, Comments & Corrections

folderitem.LaunchServicesOpenMBS as folderitem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Launch Services MBS MacOSX Plugin 3.2 Yes No No Yes, macOS only No
Function: Launches the given item.
Notes: Returns the file or folder which was launched, e.g. the application for a file.

Feedback, Comments & Corrections

folderitem.LaunchServicesRegisterMBS(update as boolean) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Launch Services MBS MacOSX Plugin 3.4 Yes No No Yes, macOS only No
Function: If the specified folderitem refers to an application or other bundle claiming to handle documents or URLs, add the bundle's document and URL claims to the Launch Services database.
Notes:
Requires Mac OS X 10.3.

Update: When false, LaunchServicesRegisterMBS does not register the item if it has already been registered and the current modification date of the item has not changed from when it was last registered. When true, the item's registered info is updated, even if the modification has not changed.

Returns an error code:
An OSStatus value: noErr (0) - Success kLSNoRegistrationInfoErr (-10824) - The item does not contain info requiring registration kLSDataErr (-10817) - The item's property list info is malformed.
Returns -1 if the function is not available.

Feedback, Comments & Corrections

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

The biggest plugin in space...




Links
MBS Xojo Plugins