Rev 81507 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/utils/man/clipboard.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2022 R Core Team% Distributed under GPL 2 or later\name{clipboard}\Rdversion{1.1}\alias{getClipboardFormats}\alias{readClipboard}\alias{writeClipboard}\alias{clipboard}\title{Read/Write to/from the Clipboard in MS Windows}\description{Transfer text between a character vector and the Windows clipboard inMS Windows (only).}\usage{getClipboardFormats(numeric = FALSE)readClipboard(format = 13, raw = FALSE)writeClipboard(str, format = 13)}\arguments{\item{numeric}{logical: should the result be in human-readable form(the default) or raw numbers?}\item{format}{an integer giving the desired format.}\item{raw}{should the value be returned as a raw vector rather thanas a character vector?}\item{str}{a character vector or a raw vector.}}\details{The Windows clipboard offers data in a number of formats: seee.g.\sspace{}\url{https://docs.microsoft.com/en-gb/windows/desktop/dataxchg/clipboard-formats}.The standard formats include\tabular{lrl}{CF_TEXT \tab 1 \tab Text in the machine's locale\crCF_BITMAP \tab 2 \tab \crCF_METAFILEPICT \tab 3 \tab Metafile picture\crCF_SYLK \tab 4 \tab Symbolic link\crCF_DIF \tab 5 \tab Data Interchange Format\crCF_TIFF \tab 6 \tab Tagged-Image File Format\crCF_OEMTEXT \tab 7 \tab Text in the OEM codepage\crCF_DIB \tab 8 \tab Device-Independent Bitmap\crCF_PALETTE \tab 9 \tab \crCF_PENDATA \tab 10 \tab \crCF_RIFF \tab 11 \tab Audio data\crCF_WAVE \tab 12 \tab Audio data\crCF_UNICODETEXT \tab 13 \tab Text in Unicode (UCS-2)\crCF_ENHMETAFILE \tab 14 \tab Enhanced metafile\crCF_HDROP \tab 15 \tab Drag-and-drop data\crCF_LOCALE \tab 16 \tab Locale for the text on the clipboard\crCF_MAX \tab 17 \tab Shell-oriented formats\cr}Applications normally make data available in one or more of these andpossibly additional private formats. Use \code{raw = TRUE} to read binaryformats, \code{raw = FALSE} (the default) for text formats. Thecurrent codepage is used to convert text to Unicode text, andinformation on that is contained in the \code{CF_LOCALE} format.(Take care if you are running R in a different locale from Windows. It isrecommended to read as Unicode text, so that Windows does the conversionbased on \code{CF_LOCALE}, if available.)The \code{writeClipboard} function will write a character vector astext or Unicode text with standard CR-LF line terminators. It willcopy a raw vector directly to the clipboard without any changes. It isrecommended to use Unicode text (the default) instead of text to avoid interoperabilityproblems. (Note that \R 4.2 and newer on recent systems uses UTF-8 as thenative encoding but the machine's locale uses a different encoding.)}\value{For \code{getClipboardFormats}, a character or integer vector ofavailable formats, in numeric order. If non human-readable characterrepresentation is known, the number is returned.For \code{readClipboard}, a character vector by default, a raw vectorif \code{raw} is \code{TRUE}, or \code{NULL}, if the format isunavailable.For \code{writeClipboard} an invisible logical indicating success orfailure.}\note{This is only available on Windows.}\seealso{\code{\link{file}} which can be used to set up a connection to a clipboard.}\keyword{utilities}