Clipboard.RawData

From Xojo Documentation

Method

Clipboard.RawData(dataType as String, Assigns value As String)

New in 2005r1

Supported for all project types and targets.

Method

Clipboard.RawData(dataType as String) As String

New in 2005r1

Supported for all project types and targets.

Used to get and set binary data from/to the Clipboard as a string for the specified type or UTI.

Notes

The DataType parameter supports both the older MacType and newer UTIs. If the DataType parameter is exactly 4 bytes then it is treated as a MacType for backwards compatibility. Otherwise it is treated as a UTI. An example would be "public.rtf".

On Windows you can use the a special DataType called "HTML Format" to add or fetch HTML data from the clipboard[1].

Sample Code

This code reads the contents of the Clipbpoard as an mp3 file.

Var c As New Clipboard
Var s As String
s = c.RawData("public.mp3") // UTI
c.Close

On Windows, this code gets HTML data from the Clipboard:

Var c As New Clipboard
Var html As String
html = c.RawData("HTML Format")
c.Close

The following code places the contents of TextArea1 on the Clipboard. It contains RTF text:

Var c As New Clipboard
c.RawData("public.rtf") = TextArea1.Value
c.Close