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
39
votes
3 answers

How to copy string to clipboard in C?

The SetClipboardData function requires a HANDLE reference; I'm having trouble converting my string for use in the function. Here is my code: char* output = "Test"; HLOCAL hMem = LocalAlloc( LHND,1024); char* cptr = (char*) LocalLock(hMem); memcpy(…
unknown
38
votes
3 answers

getting HTML source or rich text from the X clipboard

How can rich text or HTML source code be obtained from the X clipboard? For example, if you copy some text from a web browser and paste it into kompozer, it pastes as HTML, with links etc. preserved. However, xclip -o for the same selection just…
intuited
  • 23,174
  • 7
  • 66
  • 88
38
votes
1 answer

How windows handle the clipboard interface with Xming?

My question comes from a problem: I Use Xming on Windows 7 to connect to a Linux host (through PuTTY) in order to start and display a gnome-terminal. I have some troubles using the Windows clipboard: Copy from Windows to Xming works well. (Ctrl-C…
Jonathan
  • 764
  • 6
  • 14
37
votes
4 answers

Copy to Clipboard for all Browsers using javascript

I was trying to make "Copy to Clipboard" work on all browsers but no luck. Am using javascript and I don't want to use Zero Clipboard to do. Please let us know what wrong in my code. Appreciate for your help. Below is the code (Currently my code is…
Siva Charan
  • 17,940
  • 9
  • 60
  • 95
36
votes
3 answers

How to fix broken paste clipboard in VNC on Windows

When using RealVNC on Windows, I can sometimes cut and paste from VNC into Window's apps, and sometimes it just stops working. How can I get it reset so it works again? I've tried restarting VNC, but that doesn't do it.
SDGator
  • 2,027
  • 3
  • 21
  • 25
35
votes
4 answers

How to paste CSV data to Windows Clipboard with C#

What I'm trying to accomplish My app generates some tabular data I want the user to be able to launch Excel and click "paste" to place the data as cells in Excel Windows accepts a format called "CommaSeparatedValue" that is used with it's APIs so…
namenlos
  • 5,111
  • 10
  • 38
  • 38
35
votes
5 answers

Is it possible to read the clipboard in Firefox, Safari and Chrome using JavaScript?

I'm trying to read the contents of the clipboard using JavaScript. With Internet Explorer it's possible using the function window.clipboardData.getData("Text") Is there a similar way of reading the clipboard in Firefox, Safari and Chrome?
Gil Faria
  • 710
  • 2
  • 7
  • 9
34
votes
12 answers

Access clipboard in Windows batch file

Any idea how to access the Windows clipboard using a batch file?
random21
  • 579
  • 1
  • 5
  • 15
33
votes
2 answers

Copy the contents of a file to clipboard from WSL to Windows?

Rig description: I've installed Debian in Windows Subsystem Linux (WSL) on Windows 10. The host means Windows 10. The box means my WSL-Debian box/container. Goal: I have an SSH key on WSL (my_rsa.pub); I want to copy the contents of that file to…
Wolfpack'08
  • 3,982
  • 11
  • 46
  • 78
33
votes
7 answers

Copy text to clipboard from bookmarklet

I'm trying to write a little bookmarklet that can extract some text from the active page and load that into the clipboard. The extraction is easy enough, but I'm really stuck doing the clipboard-copying part. Currently, I'm just alerting the text…
Ani
  • 111,048
  • 26
  • 262
  • 307
33
votes
3 answers

How to paste on click? It works in google docs

I want to be able to initiate real paste event when user clicks. I can understand this may be a security issue, because if any webpage had access to users clipboard, that would be bad. So I thought all browsers disallow accessing clipboard data. But…
Tomas M
  • 6,919
  • 6
  • 27
  • 33
33
votes
4 answers

"Current thread must be set to single thread apartment (STA)" error in copy string to clipboard

I have tried code from How to copy data to clipboard in C#: Clipboard.SetText("Test!"); And I get this error: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has…
user1823701
  • 431
  • 1
  • 5
  • 8
32
votes
2 answers

Get CSV Data from Clipboard (pasted from Excel) that contains accented characters

SCENARIO My users will copy cells from Excel (thus placing it into the clipboard) And my application will retrieve those cells from the clipboard THE PROBLEM My code retrieves the CSV format from the clipboard However, the if the original Excel…
namenlos
  • 5,111
  • 10
  • 38
  • 38
32
votes
4 answers

Copy to clipboard with break line

I want to copy a text to clipboard but in a new line. Problem: If you click the button in the snippet and paste in the notepad this is what you gonna get: Name: testSurname: testEmail: test@gmail.comAddress: testCity: testCountry: nullAd Category:…
user7038047
32
votes
5 answers

Copy pandas dataframe to excel using openpyxl

I have some complicated formating saved in a template file into which I need to save data from a pandas dataframe. Problem is when I use pd.to_excel to save to this worksheet, pandas overwrites the formatting. Is there a way to somehow 'paste…
blitz009
  • 321
  • 1
  • 3
  • 3