== Description
win32-clipboard - a Ruby library for interacting with the MS Windows clipboard.
== Installation
gem install win32-clipboard
== Synopsis
require 'win32/clipboard'
include Win32
puts "Data on clipboard: " + Clipboard.data
puts "Number of available formats: " + Clipboard.num_formats.to_s
puts "Setting data to 'foobar'"
Clipboard.set_data("foobar")
puts "Clipboard now contains: " + Clipboard.data
puts "Clearing clipboard"
Clipboard.empty
== Class Methods
Clipboard.data(format=nil)
Returns the data currently in the clipboard. If +format+ is
specified, it will attempt to retrieve the data in that format. The
default is Clipboard::TEXT. See the 'Constants' section for
the supported formats.
If there is no data in the clipboard, then an empty string is returned.
Note that this method does implicit conversions on formats with regards
to text data. See the MSDN documentation for more details.
Clipboard.empty
Empty the contents of the clipboard
Clipboard.format_available?(format_number)
Returns true if 'format_number' is currently available on the clipboard,
false otherwise.
Clipboard.format_name(format_number)
Returns the corresponding name for the given 'format_number', or nil
if it does not exist.
Clipboard.formats
Returns a hash of all the current formats, with the format number as the
key and the format name as the value for that key.
Clipboard.get_data(format=nil)
Alias for Clipboard.data.
Clipboard.num_formats
Returns the number of different data formats currently on the clipboard.
Clipboard.register_format(format)
Registers the given 'format' (a String) as a clipboard format, which
can then be used as a valid clipboard format.
If a registered format with the specified name already exists, a new
format is not registered and the return value identifies the existing
format. This enables more than one application to copy and paste data
using the same registered clipboard format. Note that the format name
comparison is case-insensitive.
Registered clipboard formats are identified by values in the range 0xC000
through 0xFFFF.
Clipboard.set_data(data, format=nil)
Sets the clipboard contents to the data that you specify. You may
optionally specify a clipboard format. The default is Clipboard::TEXT.
See the 'Constants' section for a list of the supported formats.
== Constants
=== Standard Constants
VERSION
Returns the current version number of this package, as a String.
=== Clipboard Formats
Clipboard::OEMTEXT
Text format containing characters in the OEM character set. Each line ends
with a carriage return/linefeed (CR-LF) combination. A null character
signals the end of the data.
Clipboard::TEXT
Text format. Each line ends with a carriage return/linefeed (CR-LF)
combination. A null character signals the end of the data. Use this format
for ANSI text.
Clipboard::UNICODETEXT
Unicode text format. Each line ends with a carriage return/linefeed
(CR-LF) combination. A null character signals the end of the data.
== Future Plans
Add more formatting option contants and related methods.
== License
Artistic 2.0
== Copyright
(C) 2003-2015 Daniel J. Berger
All Rights Reserved
== Authors
Daniel J. Berger
Park Heesob
Project
win32-clipboard
The win32-clipboard library provides an interface for interacting
with the Windows clipboard. It supports the ability to read and
write text, images, files, and Windows metafiles.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
Pull Requests
Development
Primary Language
Ruby
Licenses
Artistic 2.0
Project Readme