clipboard {utils}R Documentation

Read/Write to/from the Windows Clipboard

Description

Transfer text between a character vector and the Windows clipboard.

Usage

getClipboardFormats()
readClipboard(format = 1, raw = FALSE)
writeClipboard(str, format = 1)

Arguments

format an integer giving the desired format.
raw should the value be returned as a raw vector rather than a character vector?
str a character vector or a raw vector.

Details

The Windows clipboard offers data in a number of formats. The standard formats are
CF_TEXT 1
CF_BITMAP 2
CF_METAFILEPICT 3
CF_SYLK 4
CF_DIF 5
CF_TIFF 6
CF_OEMTEXT 7
CF_DIB 8
CF_PALETTE 9
CF_PENDATA 10
CF_RIFF 11
CF_WAVE 12
CF_UNICODETEXT 13
CF_ENHMETAFILE 14
CF_HDROP 15
CF_LOCALE 16
CF_MAX 17
CF_OWNERDISPLAY 128
CF_DSPTEXT 129
CF_DSPBITMAP 130
CF_DSPMETAFILEPICT 131
CF_DSPENHMETAFILE 142
CF_PRIVATEFIRST 512
CF_PRIVATELAST 767
CF_GDIOBJFIRST 768
CF_GDIOBJLAST 1023
Applications normally make data available in one or more of these and possibly additional private formats. Use raw=TRUE to read binary formats, raw=FALSE (the default) for text formats.

The writeClipboard function will write a character vector as text, with standard CR-LF line terminators. It will copy a raw vector directly to the clipboard without any changes.

Value

For getClipboardFormats, an integer vector of available formats.
For readClipboard, a character vector by default, a raw vector if raw is TRUE, or NULL, if the format is unavailable.
For writeClipboard an invisible logical indicating success or failure.

See Also

file which can be used to set up a connection to a clipboard.


[Package utils version 2.4.1 Index]