LSOpenItemsWithRole(_:_:_:_:_:_:_:)
Opens items with an array of file-system references with a specified role.
Declaration
func LSOpenItemsWithRole(_ inItems: UnsafePointer<FSRef>!, _ inItemCount: CFIndex, _ inRole: LSRolesMask, _ inAEParam: UnsafePointer<AEKeyDesc>!, _ inAppParams: UnsafePointer<LSApplicationParameters>!, _ outPSNs: UnsafeMutablePointer<ProcessSerialNumber>!, _ inMaxPSNCount: CFIndex) -> OSStatusParameters
- inItems:
An array of values of type
FSRef. - inItemCount:
The number of items specified in
inItems. - inRole:
A value of type
LSRolesMaskspecifying one or more roles. If the role doesn’t matter, usekLSRolesAll. For possible values, see Lsrolesmask. If theinAppParamsparameter is notNULL, this parameter is ignored. - inAEParam:
An
AEKeyDescthat is to be attached to the Apple Event(s) generated by Launch Services with the specifiedAEKeyword. This parameter can beNULL. - inAppParams:
An Lsapplicationparameters structure specifying the application to launch and its launch parameters, in which case the
inRoleparameter is ignored. This parameter can beNULL, in which case an application is selected that can handle each input item in at least one of the roles specified by theinRoleparameter. - outPSNs:
On input, a pointer to a caller-allocated buffer or
NULLif you don’t want to receive process serial number (PSN) information. If notNULLon input, on return, the buffer contains at each index the PSN that was used to open the item at the same index of the input item array (inItems). - inMaxPSNCount:
The maximum number of PSNs that the buffer pointed to by
outPSNscan hold.
Return Value
A result code; see Result Codes.
Discussion
This function opens the specified items with the specified role. You can optionally specify the application and launch parameters in the inAppParams parameter. If an application is specified in the inAppParams parameter, the inRole parameter is ignored and the application is launched (if necessary).
Each application (regardless of whether it is launched or already running) receives an 'odoc' Apple Event specifying the items that are to be opened.
If the inItems array contains any applications, this function launches them only if the kLSRolesShell bit is set in the inRoles parameter to indicate that the operating system should use the application itself as the execution shell of the new process.
If not NULL, the outPSNs buffer is filled with the PSN that was used to open each item at the same index of the inItems array. The PSN capacity of the output buffer is specified by inMaxPSNCount.
Version-Notes
Thread-safe since OS X v10.4.
See Also
Deprecated Functions
LSGetHandlerOptionsForContentType(_:)LSSetHandlerOptionsForContentType(_:_:)LSCopyAllHandlersForURLScheme(_:)LSCopyDefaultHandlerForURLScheme(_:)LSGetApplicationForItem(_:_:_:_:)LSGetApplicationForURL(_:_:_:_:)LSGetApplicationForInfo(_:_:_:_:_:_:)LSCopyApplicationForMIMEType(_:_:_:)LSCanRefAcceptItem(_:_:_:_:_:)LSFindApplicationForInfo(_:_:_:_:_:)LSOpenApplication(_:_:)LSOpenURLsWithRole(_:_:_:_:_:_:)LSOpenFSRef(_:_:)LSOpenFromRefSpec(_:_:)LSCopyItemInfoForRef(_:_:_:)LSCopyItemInfoForURL(_:_:_:)LSCopyDisplayNameForRef(_:_:)LSCopyDisplayNameForURL(_:_:)LSCopyKindStringForRef(_:_:)LSCopyKindStringForURL(_:_:)LSCopyKindStringForTypeInfo(_:_:_:_:)LSCopyKindStringForMIMEType(_:_:)LSCopyItemAttribute(_:_:_:_:)LSCopyItemAttributes(_:_:_:_:)LSGetExtensionInfo(_:_:_:)LSSetExtensionHiddenForRef(_:_:)LSSetExtensionHiddenForURL(_:_:)LSRegisterFSRef(_:_:)