Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSPasteboardItemMBS class.

NSPasteboardItemMBS.availableTypeFromArray(types() as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Clipboard MBS MacBase Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns from a given array of types the the first type contained in the pasteboard item, according to the ordering of types.

types: An array of strings representing UTIs, arranged in order of preference (most preferred as the 0th element in the array).

Returns the first (according to the sender's ordering of types) type in types contained in the pasteboard item, or nil if the receiver does not contain any types given in types.

The method checks for UTI conformance of the requested types, preferring an exact match to conformance.
Available in OS X v10.6 and later.

Some examples using this method:

NSPasteboardItemMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Clipboard MBS MacBase Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The constructor.

NSPasteboardItemMBS.dataForType(type as string) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Clipboard MBS MacBase Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The value for a specified type as a memoryblock object.
Example
Var n as new NSPasteboardItemMBS

Var data as MemoryBlock = "Hello World"
Var type as string = NSPasteboardmbs.NSPasteboardTypeString
n.dataForType(type) = data

Var d as MemoryBlock = n.dataForType(type)
MsgBox DefineEncoding(d, encodings.UTF8)

(Read and Write computed property)

NSPasteboardItemMBS.Destructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Clipboard MBS MacBase Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The destructor.

NSPasteboardItemMBS.detectMetadata(types() as String, theDelegate as NSPasteboardMBS.detectValuesCompletedMBS, tag as variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Clipboard MBS MacBase Plugin 25.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Determines available metadata from the specified metadata types for this pasteboard item, without notifying the user.

Because this method only gives access to limited types of metadata and doesn’t allow the app to access the contents, the system doesn’t notify the user about reading the contents of the pasteboard.

For details about the metadata returned for each type.

types: The metadata types to detect on the pasteboard item.
theDelegate: A delegate that the system invokes after detecting metadata on the pasteboard item. The delegate receives either a dictionary with the metadata types found on the pasteboard item or an error if detection failed. The dictionary keys specify the matched metadata types, and the values specify the corresponding metadata.
tag: a value passed on to the delegate.

Requires macOS 15.4 or newer.

NSPasteboardItemMBS.detectPatterns(patterns() as String, theDelegate as NSPasteboardMBS.detectPatternsCompletedMBS, tag as variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Clipboard MBS MacBase Plugin 25.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Determines whether this pasteboard item matches the specified patterns, without notifying the user.

Because this method only gives an indication of whether a pasteboard item matches a particular pattern and doesn’t allow the app to access the contents, the system doesn’t notify the user about reading the contents of the pasteboard.

patterns: The patterns to detect on the pasteboard item.
theDelegate: A delegate that the system invokes after detecting patterns on the pasteboard item. The delegate receives either a set with the patterns found on the pasteboard item or an error if detection failed.
tag: a value passed on to the delegate.

Requires macOS 15.4 or newer.

NSPasteboardItemMBS.detectValues(patterns() as String, theDelegate as NSPasteboardMBS.detectValuesCompletedMBS, tag as variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Clipboard MBS MacBase Plugin 25.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Determines whether this pasteboard item matches the specified patterns, reading the contents if it finds a match.

Important: Calling this method notifies the user that the app has read the contents of the pasteboard, if a match is found.

For details about the types returned for each pattern, see shared methods.

patterns: The patterns to detect on the pasteboard item.
theDelegate: A delegate that the system invokes after detecting patterns on the pasteboard item. The delegate returns either dictionary with the patterns found on the pasteboard item or an error if detection failed. The dictionary keys specify the matched patterns, and the values specify the corresponding content of the pasteboard.
tag: a value passed on to the delegate.

Requires macOS 15.4 or newer.

NSPasteboardItemMBS.propertyListForType(type as string) as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Clipboard MBS MacBase Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The value for a specified type as a property list.

Stores a property list object (array, dictionary, string, numbers, memoryblocks)
Available in OS X v10.6 and later.
(Read and Write computed property)

NSPasteboardItemMBS.setDataProviderForType(dataProvider as NSPasteboardItemDataProviderMBS, types() as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Clipboard MBS MacBase Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Sets the data provider for the specified types.

dataProvider: A pasteboard data provider.
types: An array of strings indicating the UTIs for the data representations dataProvider may provide.

Returns true if the data provider was set successfully, otherwise false.

This method registers the data provider to be messaged to provide the data for any of the specified types when requested.
Available in OS X v10.6 and later.

Some examples using this method:

NSPasteboardItemMBS.stringForType(type as string) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Clipboard MBS MacBase Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The value for the specified type as a string.
Example
Var n as new NSPasteboardItemMBS

Var type as string = NSPasteboardmbs.NSPasteboardTypeString
n.stringForType(type) = "Hello World"
MsgBox n.stringForType(type)

type: A UTI type string.

Available in OS X v10.6 and later.
(Read and Write computed property)

NSPasteboardItemMBS.types as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Clipboard MBS MacBase Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns an array of UTI strings of the data types supported by the receiver.

Available in OS X v10.6 and later.

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


The biggest plugin in space...