WINCLIP

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLE
SEE ALSO
AUTHOR
BUGS

NAME

winclip - console Windows clipboard interface

SYNOPSIS

winclip [-h|-v] [-w|-u|-m|-g|-r] [-b] [-l lang] [-s sublang] -c|-p|-i [file]

DESCRIPTION

Winclip provides access to the Windows clipboard from a console or MS-DOS window. Its operation depends on its mandatory argument. When executed with the -p (paste) argument it pastes the Windows clipboard to its standard output or to the file optionally specified in the command line. The winclip output may be redirected to a file (using the shell > syntax) or to another process (using the shell | pipeline syntax). When winclip is executed with the -c (copy) argument it copies its standard input (or the file optionally specified in the command line) to the Windows clipboard. Again, winclip input may be redirected to be read from a file (using the < shell syntax), or from another process of a pipeline. Finally, when winclip is executed with the -i (information) argument it will print on its standard output all data formats that can be retrieved from the clipboard.

Winclip can currently paste text clipboard data, filenames that have been copied in the Windows explorer, and bitmaps which are pasted in binary ppm format. When tranfering text, it will automatically perform the appropriate Windows to console character code (OEM) set translations. Winclip is an Intel architecture Win32 program that only works under the Intel processor versions of Windows NT, 95, 98, Me, 2000, XP.

OPTIONS

-c

Copy the standard input to the Windows clipboard.

-p

Copy the Windows clipboard contents to the standard output.

-i

Print on the standard output the data formats available in the clipboard. Each format is displayed on a separate line. The standard clipboard formats are printed using their Windows API CF_ names; all other formats are printed using their registered name.

-w

Transfer text in the Windows-native format (CF_TEXT) instead of the (default) DOS-native format (CF_OEMTEXT). The Windows format is also known as ANSI text, but often represents another Windows and locale-specific code page. Setting this option will affect how non-ASCII characters will be encoded for clipboard text and copied file icons.

-u

Transfer text in Unicode format (CF_UNICODETEXT) instead of the (default) DOS-native format (CF_OEMTEXT). The Unicode encoding is the same as the one used by the Windows clipboard: apparently UCS-16 in little-endian byte order (UTF-16LE). Setting this option will affect how non-ASCII characters will be encoded for clipboard text and copied file icons.

-m

Transfer text in Unicode format (CF_UNICODETEXT) instead of the (default) DOS-native format (CF_OEMTEXT). The Unicode encoding is UTF-8. Setting this option will affect how non-ASCII characters will be encoded for clipboard text and copied file icons.

-r

Copy into the clipboard text specified to be in rich text format (RTF).

-b

When outputing Unicode text, prepend a byte order mark (BOM) at the beginning. This may make it easier for other tools to recognize winclip’s output format. When reading data for the clipboard, automatically detect Unicode data, and set the encoding and endianess, if a byte-order-mark is detected.

-l lang

Specify the language identifier for the text to be copied into the clipboard. The default value is Neutral. The identifier is case insensitive. Specify the identifier Help to obtain a list of supported language settings.

-s sublang

Specify the sub-language identifier for the text to be copied into the clipboard. The default value is Default. The identifier is case insensitive. Specify the identifier Help to obtain a list of supported sublanguage settings. Specifying a sublanguage setting without the corresponding language setting is probably not a good idea. The combination of the default language and sublanguage identifiers in effect result in the clipboard data getting marked as belonging to the user default language.

-g

Specify that the data to be copied into the clipboard is a graphics image. The program uses builtin code for loading 8-bit portable pixmap files (files starting with the P6 magic number), and a Windows OLE interface for loading many other image files. The OLE interface has been tested with JPEG, GIF, and BMP files.

-v

Print the program’s version on the standard output and exit.

-h

Print a short help text on the program’s operation on the standard output and exit.

EXAMPLE

dir /b | winclip -c
Copies the directory list to the Windows clipboard.

winclip -p file.txt
Saves the Windows clipboard to file.txt.

winclip -p | perl -pe "tr/[A-Z]/[a-z]/" | winclip -c
Converts the contents of the Windows clipboard to lowercase.

winclip -c -l Portuguese -s Portuguese_Brazilian file.txt
Copies the file file.txt to the Windows clipboard. The clipboard’s contents are marked to contain text in the language Portuguese and sublanguage Portuguese_Brazilian.

pygmentize -f rtf code.js | winclip -cr
Copies into the clipboard syntax-colored RTF generated by pygmentize.

SEE ALSO

D. Spinellis. Outwit: Unix tool-based programming meets the Windows world. In USENIX 2000 Technical Conference Proceedings, San Diego, CA, USA, June 2000, USENIX Association.

AUTHOR

(C) Copyright 1994-2005 Diomidis Spinellis. All rights reserved.

Permission to use, copy, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.

THIS SOFTWARE IS PROVIDED ‘‘AS IS’’ AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

BUGS

Should handle more clipboard content types.

Winclip may not work as expected if the code page of the console window it is running is different from the code page of the clipboard data or the code page it is specified to use. You can check and change a console code page using the chcp command.

In operations involving 8-bit (non-Unicode) data, the input locale (that’s right, the active keyboard translation) in effect at the time the text is placed in the clipboard determines the character set associated with the clipboard data. Therefore, if you want to associate a Tamil or Greek code page with the clipboard data, ensure that you have correctly set the active keyboard type at the time you copy the data.