clipboard

How to stop Emacs from “contaminating” the clipboard?

让人想犯罪 __ 提交于 2019-12-05 05:56:29
Emacs always copies killed/deleted content to the clipboard. I often need to copy and paste content into Emacs but when I delete existing content from Emacs before pasting, the content I would like to paste is lost. The only solution I found is to use (setq save-interprogram-paste-before-kill t) in order to make sure content copied outside of Emacs stays available in the kill-ring, and people with similar problems seem to be satisfied with this solution. What bothers me about it is that I have to type C-y followed by one or more repetitions of M-y to get to the content I want to paste. So my

How to copy both - HTML and text to the clipboard?

一笑奈何 提交于 2019-12-05 05:49:20
I'm trying to put in the clipboard piece of HTML and plain text at the same time, so that HTML-capable editors could paste HTML, and other editors could use plain text. Clipboard.SetData(DataFormats.Html, htmlWithHeader); Clipboard.SetData(DataFormats.UnicodeText, plainText); But only the last format is actually put to the clipboard. In the sample above, clipboard would contain only plaintext (as shown by Clipboard.GetDataObject().GetFormats() ). And if I swap the lines, the clipboard would have only the HTML format. How can I put both formats into the clipboard at the same time? Akram Berkawy

How to add clipboard support to Matplotlib figures?

孤街浪徒 提交于 2019-12-05 04:34:48
In MATLAB, there is a very convenient option to copy the current figure to the clipboard. Although Python/numpy/scipy/matplotlib is a great alternative to MATLAB, such an option is unfortunately missing. Can this option easily be added to Matplotlib figures? Preferably, all MPL figures should automatically benefit from this functionality. I'm using MPL's Qt4Agg backend, with PySide. EelkeSpaak Yes, it can. The idea is to replace the default plt.figure with a custom one (a technique known as monkey patching ) that injects a keyboard handler for copying to the clipboard. The following code will

Excel to clipboard with macro decimal separator

蓝咒 提交于 2019-12-05 03:22:28
I would like to copy the contents of an excel file to the clipboard, using the same separators and format regardless of user configuration. Here's my macro: Private Sub CommandButton1_Click() 'save number separators Dim d, t, u d = Application.DecimalSeparator t = Application.ThousandsSeparator u = Application.UseSystemSeparators 'set number separators With Application .DecimalSeparator = "." .ThousandsSeparator = "," .UseSystemSeparators = True End With 'create temporary copy ActiveSheet.Copy 'set number format ActiveSheet.Range("H2:I150").NumberFormat = "0.0000000000" [...] 'copy sheet to

Get the selected text of a web page in google chrome extension

妖精的绣舞 提交于 2019-12-05 02:34:41
问题 I am developing a Google Chrome extension. When a popup is clicked, I would like the input box present in the popup.html file to contain the selected text of the current webpage. Example textbox: <input id="searchBox" type="text" /> When text is selected in a webpage, the textbox should contain the selected word. I tried with chrome.extension.getBackgroundPage().getSelection() but it is not working. 回答1: There was a thread about this on google groups: how to get HTML code from selection? var

Copy DataGridView contents to clipboard

穿精又带淫゛_ 提交于 2019-12-04 23:50:35
I want to copy the contents of a DataGridView and paste it in Excel. I tried: myDataGrid.SelectAll(); DataObject dataObj = myDataGrid.GetClipboardContent(); Clipboard.SetDataObject(dataObj, true) But this just pastes nothing. Any suggestions? Have you added this line? myDataGrid.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; Take a look at this MSDN article for a working sample. If you use Microsoft Visual Studio You can do it in Design File. Your Gridview ->right Click->Propeties->ClipBoard Copy Mode->EnableWithoutHeaderText 来源: https://stackoverflow.com/questions

Error while trying to copy string to clipboard

孤街浪徒 提交于 2019-12-04 23:06:06
I have tried this code: 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 STAThreadAttribute marked on it. How can I fix it? Thousand Put [STAThread] above your main method: [STAThread] static void Main() { } You need to call that method specially, because it uses some legacy code. Try this: Thread thread = new Thread(() => Clipboard.SetText("Test!")); thread.SetApartmentState(ApartmentState.STA); //Set the thread to STA thread.Start(); thread.Join(); //Wait for the

Flutter can't read from Clipboard

江枫思渺然 提交于 2019-12-04 22:23:31
I come asking for quite a specific question regarding Flutter and the Future and await mechanism, which seems to be working, but my Clipboard does not really function while operating with my editable text fields, even following Google's advice on implementation... This is my code for pasting: onPressed: () async { await getMyData('text'); _encodingController.text = clipData; Scaffold.of(context).showSnackBar( new SnackBar( content: new Text( "Pasted from Clipboard"), ), ); }, what doesnt work is my paste functionality... While debugging the result of this following function is null, wth???????

How do I safely and correctly create a backup of the Windows clipboard?

余生颓废 提交于 2019-12-04 20:47:29
问题 I'm trying to create a backup of the Windows clipboard. Basically what I'm doing is using EnumClipboardFormats() to get all of the formats that exist on the clipboard currently, and then for each format, I'm calling GetClipboardData(format) . Part of backing up the data obviously involves duplicating it. I do that by calling GlobalLock() (which "Locks a global memory object and returns a pointer to the first byte of the object's memory block." ) on the data returned by GetClipboardData() ,

Safari browser doesn't support document.execCommand('copy'); command?

穿精又带淫゛_ 提交于 2019-12-04 19:53:33
Can you please guide me on how to fix following issue, or suggest another option for copying to the clipboard? function click_to_copy_password(containerid) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(document.getElementById(containerid)); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(document.getElementById(containerid)); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } document.execCommand('copy'); } It's working fine in Chrome, Firefox & IE, but it