Questions tagged [clipboard]

The clipboard is a software facility that can be used for short-term data storage and/or data transfer between documents or applications, via copy and paste operations.

It is most commonly a part of a GUI environment and is usually implemented as an anonymous, temporary block of memory that can be accessed from most or all programs within the environment via defined programming interfaces. A typical application accesses clipboard functionality by mapping user input (keybindings, menu selections, etc.) to these interfaces.

The semantics of the clipboard facility varies from one operating environment to another, and can also vary between versions of the same system. They can sometimes be changed programmatically or by user preference. This can lead to user frustration when switching between environments with different clipboard semantics particularly as copy and paste operations often become embedded in the user's muscle memory.

Most environments support a single clipboard transaction. Each cut or copy overwrites the previous contents. Normally, paste operations copy the contents, leaving the contents available in the clipboard for further pasting operations.

http://en.wikipedia.org/wiki/Clipboard_(software)

4050 questions
71
votes
13 answers

How can you get the clipboard contents with a Windows command?

For example, I can copy a file to the clipboard like this: clip < file.txt (Now the contents of file.txt is in the clipboard.) How can I do the opposite: ???? > file.txt So that the contents of the clipboard will be in file.txt?
Matt
  • 21,026
  • 18
  • 63
  • 115
69
votes
3 answers

Get readable text only from clipboard

I already know how to get plain text from the clipboard in Java, but sometimes the text is encoded in some weird DataFlavor, like when copying from Microsoft Word or from a website or even source code from Eclipse. How to extract pure plain text…
clamp
  • 33,000
  • 75
  • 203
  • 299
69
votes
14 answers

DOMException on calling navigator.clipboard.readText()

Following lines of code used to work and stopped working after chrome upgrade to Version 74.0.3729.169 (Official Build) (64-bit). Now I get DOMException even though permission is set correctly. Appreciate if you can explain what is the bug and…
frosty
  • 2,421
  • 6
  • 26
  • 47
69
votes
5 answers

Javascript - Copy string to clipboard as text/html

Is there a way in javascript to copy an html string (ie xx) into the clipboard as text/html, so that it can then be pasted into for example a gmail message with the formatting (ie, xx in bold) There exists solutions to copy to the clipboard as…
kofifus
  • 17,260
  • 17
  • 99
  • 173
67
votes
5 answers

Piping output from Git Bash to clipboard

I often need to relay my Git output to my ever-friendly code buddies. The best way I know how is by doing this: Right-click Git Bash title bar > Edit > Mark > Select lines > Enter Bam - everything I selected is in my clipboard, and I am filled with…
Bucket
  • 7,415
  • 9
  • 35
  • 45
66
votes
6 answers

How can I copy rich text contents to the clipboard with JavaScript?

Premise I need help copying rich text to the clipboard using JavaScript. I have searched around and haven't found anything to suit my specific needs. Code function ctrlA1(corp) { with(corp) {} if (document.all) { txt =…
marv
  • 962
  • 3
  • 9
  • 17
66
votes
9 answers

Excel VBA code to copy a specific string to clipboard

I'm trying to add a button to a spreadsheet that when clicked will copy a specific URL to my clipboard. I had a bit of knowledge of Excel VBA but it's been a while and I'm struggling.
user1958738
  • 661
  • 1
  • 5
  • 3
64
votes
3 answers

Clipboard size limit

Is there any limit of the size of data that can be copied to clipboard? I am using VB6 and need to copy blocks of data to the clipboard.
Pradeep
64
votes
6 answers

HTML5 alternative to flash-based ZeroClipboard for safe copying of data to clipboard?

With flash on the way out in many environments (iPhone, Android, IE10, etc...), is there any new solution forthcoming in any browsers that will allow a safe copy of information to the clipboard without flash installed? I've been using ZeroClipboard…
jfriend00
  • 683,504
  • 96
  • 985
  • 979
62
votes
9 answers

CLIPBRD_E_CANT_OPEN error when setting the Clipboard from .NET

Why does the following code sometimes causes an Exception with the contents "CLIPBRD_E_CANT_OPEN": Clipboard.SetText(str); This usually occurs the first time the Clipboard is used in the application and not after that.
Robert Wagner
  • 17,515
  • 9
  • 56
  • 72
62
votes
6 answers

Copy selected text to the clipboard WITHOUT using flash - must be cross-browser

I want to have a button which selects the text in a textarea and copies it to the clipboard. I can't seem to find any solutions which work in all browsers and don't use flash. Surely this is doable? I've seen it all over the place but I guess they…
Nick Brunt
  • 9,533
  • 10
  • 54
  • 83
62
votes
11 answers

Copy to Clipboard in Chrome Extension

I'm making an extension for Google Chrome and I have hit a snag. I need to copy a readonly textarea's content to the clipboard on click in the popup. Does anyone know the best way to go about this with pure Javascript and no Flash? I also have…
Kyle Ross
  • 2,090
  • 4
  • 20
  • 27
62
votes
3 answers

How to copy/paste DataFrame from Stack Overflow into Python

In questions and answers, users very often post an example DataFrame which their question/answer works with: In []: x Out[]: bar foo 0 4 1 1 5 2 2 6 3 It'd be really useful to be able to get this DataFrame into my Python…
LondonRob
  • 73,083
  • 37
  • 144
  • 201
61
votes
1 answer

Set text and get text from clipboard

In Android, I need some code to "get text" and "set text" in the clipboard. For example I want to put "asd" in memory and after that paste it from clipboard.
Lukap
  • 31,523
  • 64
  • 157
  • 244
61
votes
14 answers

Using execCommand (Javascript) to copy hidden text to clipboard

I'm trying to copy to clipboard without using Flash, I plan to fall back onto Flash with the use of ZeroClipboard if the browser is incompatible with the javascript approach. I have an onClick listener for the button which looks…
Aaron Critchley
  • 2,335
  • 2
  • 19
  • 32