How to make Vim paste from (and copy to) the system’s clipboard?

TL;DR Try using “*yy or “+yy to copy a line to your system’s clipboard. Full answer Be aware that copying/pasting from the system clipboard will not work if :echo has(‘clipboard’) returns 0. In this case, Vim is not compiled with the +clipboard feature and you’ll have to install a different version or recompile it. Some … Read more

How can I copy a string to the clipboard within my console application WITHOUT adding a reference to System.Windows.Forms?

Platform invoking the clipboard APIs is a possible solution. Example: using System.Runtime.InteropServices; class Program { [DllImport(“user32.dll”)] internal static extern bool OpenClipboard(IntPtr hWndNewOwner); [DllImport(“user32.dll”)] internal static extern bool CloseClipboard(); [DllImport(“user32.dll”)] internal static extern bool SetClipboardData(uint uFormat, IntPtr data); [STAThread] static void Main(string[] args) { OpenClipboard(IntPtr.Zero); var yourString = “Hello World!”; var ptr = Marshal.StringToHGlobalUni(yourString); SetClipboardData(13, ptr); … Read more

How might I pass text data from the ruby console into my clipboard without saving to a file?

You can just echo it instead if there are no newline characters in the string; otherwise, use the IO class. Using echo: system “echo #{stringdata} | pbcopy” OR `echo #{stringdata} | pbcopy` Ruby will then just rip the text from memory, inject it into the shell command which opens a pipe between the echo and … Read more

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

Excel stores the string on the clipboard using the Unicode character encoding. The reason you get a square when you try to read the string in ANSI is that there is no representation for that character in your system’s ANSI codepage. You should just use Unicode. If you’re going to be dealing with localization issues, … Read more

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 … The above is the bottom line.. Having this code JS Fiddle var Copy = document.getElementById(‘copy’), Cut = document.getElementById(‘cut’), Paste = document.getElementById(‘paste’); // Checking Clipboard API without an action from the user … Read more

Copy pandas dataframe to excel using openpyxl

openpyxl 2.4 comes with a utility for converting Pandas Dataframes into something that openpyxl can work with directly. Code would look a bit like this: from openpyxl.utils.dataframe import dataframe_to_rows rows = dataframe_to_rows(df) for r_idx, row in enumerate(rows, 1): for c_idx, value in enumerate(row, 1): ws.cell(row=r_idx, column=c_idx, value=value) You can adjust the start of the enumeration … Read more

Access clipboard in Windows batch file

To set the contents of the clipboard, as Chris Thornton, klaatu, and bunches of others have said, use %windir%\system32\clip.exe. Update 2: For a quick one-liner, you could do something like this: powershell -sta “add-type -as System.Windows.Forms; [windows.forms.clipboard]::GetText()” Capture and parse with a for /F loop if needed. This will not execute as quickly as the … Read more