Skip to content

Wishlist - access non-text from clipboard in Windows

7 messages · Duncan Murdoch, Gabor Grothendieck

#
Just wanted to post this wishlist item.

Currently one can read text from the Windows clipboard but the Windows
clipboard can hold all sorts of objects, not just text, and it can
hold them simultaneously.  For example, if one selects some cells in
Excel and then copies them to the clipboard, the clipboard will have
all the cell boundary information but R can only read the text and
will have to figure it out if it can.

It would be nice if the user could use R to access all the information on
the clipboard, not just the text.
#
On 9/22/2005 11:13 AM, Gabor Grothendieck wrote:
This looks like something someone should write a package to do.  It 
needs lots of support (e.g. what do all the possible clipboard format 
constants mean, what binary format corresponds to each, etc.), but it 
would only be useful on the Windows platform.

Duncan Murdoch
#
There is an open source clipboard extender CLCL that handles all
clipboard formats.  I think this code could be leveraged to simplify
it substantially.  Run CLCL and copy something from IE or Excel,
say, so that you have a complex object in the clipboard.
Now expand Clipboard in the left pane and the various components
in the clipboard are shown in the tree as children.  You can right click
and save any of them.

If this code could be followed it might be simple to just have a new
argument to clipboard() which specified which component to return
or one could optionally return a list of all of them.
On 9/22/05, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
#
On 9/22/2005 1:12 PM, Gabor Grothendieck wrote:
We'd need to write clipboard() first.  This might be a good idea, but 
it's not at the top of my priority list.

I think a better thing for R to do is to make sure it's easy for package 
writers to write connections.  Then a package writer could write 
clipboard(), and it would fit into the rest of the R machinery.

Duncan Murdoch
#
On 9/22/05, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
Sorry, its readClipboard() rather than clipboard().  See ?readClipboard
#
On 9/22/2005 2:50 PM, Gabor Grothendieck wrote:
I don't think I ever noticed that function.  It looks tricky to 
determine how much data is there.  For text it goes to the first NULL 
character, but what do you do for other formats?  Can you see how the 
package you mentioned does it?

Duncan Murdoch
#
On 9/22/05, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
Look in clipboard.c in the source. It seems to use GetClipboardData.
See Microsoft's site:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/dataexchange/clipboard/clipboardreference/clipboardfunctions/getclipboarddata.asp

or just google for GetClipboardData .  Its the first hit.