clipboard

Android: Copy to clipboard selected text from a TextView

非 Y 不嫁゛ 提交于 2019-12-17 17:34:26
问题 Is there a possibility to copy to clipboard from a TextView UI component only the selected text? I've catched the long press event and I copied the full text to clipboard, but now I want to specify the start and the end of the selection to be copied from a TextView. Thank you. 回答1: TextView tv; String stringYouExtracted = tv.getText().toString(); int startIndex = tv.getSelectionStart(); int endIndex = tv.getSelectionEnd(); stringYouExtracted = stringYouExtracted.subString(startIndex, endIndex

Yank file name / path of current buffer in Vim

可紊 提交于 2019-12-17 17:19:22
问题 Assuming the current buffer is a file open for edit, so :e does not display E32: No file name . I would like to yank one or all of: The file name exactly as show on the status line, e.g. ~\myfile.txt A full path to the file, e.g. c:\foo\bar\myfile.txt Just the file name, e.g. myfile.txt 回答1: TL;DR :let @" = expand("%") > this will copy the file name to the unamed register , then you can use good old p to paste it. and of course you can map this to a key for quicker use. :nmap cp :let @" =

listen to clipboard changes, check ownership?

自作多情 提交于 2019-12-17 16:37:24
问题 I want to be notified if a string is copied to the system clipboard. When a new string is copied from the same source application, the FlavorListener won't get an event. To get informed when another string is copied, i read the string from the clipboard, convert it to a SrtingSelection, which is able to take the ownership, and put it back to the clipboard. Now I got informed twice, once the StringSelection lost ownership and once it takes it back. Is there a way to check for the ownership

Copy and paste clipboard in JavaScript. or jQuery

此生再无相见时 提交于 2019-12-17 13:26:11
问题 How do I copy content thats present in a div tag and paste it to applications like Paint, Powerpoint etc. 回答1: It is not easy but possible: function copyToClipboard(meintext) { if (window.clipboardData) window.clipboardData.setData("Text", meintext); else if (window.netscape) { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); if (!clip) return false;

Copy/Paste not working in a signed Applet

醉酒当歌 提交于 2019-12-17 12:36:54
问题 I've a signed applet (which verifies correctly with jarsigner ) that for some reason will not allow copy and paste from the system clipboard into a JTextField despite the documentation telling me that it is supposed to work for signed applets. Furthermore, I've other applets which are signed with the same keyfile that do let me copy and paste text. I have searched high and low on the internet and can't seem to find any clues. What is making me pull my hair out is that there seems to be no way

How can I disable clear of clipboard on exit of PyQt application?

蹲街弑〆低调 提交于 2019-12-17 12:34:57
问题 I have a simple PyQt4 application (see the code below) that reveals a problem: if I select the text from a QLineEdit and copy it to the clipboard, then I can paste it to another application only while my application is running. It seems that on exit, PyQt application clears the clipboard so I can't paste the text after the application is closed. What can I do to avoid this problem? PyQt 4.4.3 @ Python 2.5 @ Windows XP. Also this effect confirmed on PyQt 4.5+, and on Linux too. import sys from

Copy files to clipboard in C#

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 10:41:24
问题 I have a Windows Forms TreeView (node, subnodes). Each node contains some additional information in its Tag. Also, each nodes maps a file on the disk. What's the easiest way copy/cut/paste nodes/files in C#? It would be nice to have some sample code. 回答1: Consider using the Clipboard class. It features all the methods necessary for putting data on the Windows clipboard and to retrieve data from the Windows clipboard. StringCollection paths = new StringCollection(); paths.Add("f:\\temp\\test

Clipboard Copying objects to and from

六眼飞鱼酱① 提交于 2019-12-17 09:56:28
问题 I am trying to copy an object onto the windows clipboard and off again. My code is like this: Copy on to clipboard: Clipboard.Clear(); DataObject newObject = new DataObject(prompts); newObject.SetData(myString); Clipboard.SetDataObject(newObject); Where prompts is a List<Data.Sources.PromptResult> collection. Copy off clipboard: IDataObject dataObject = System.Windows.Forms.Clipboard.GetDataObject(); if (dataObject.GetDataPresent(typeof(List<Data.Sources.PromptResult>))) { Type type = typeof

How do I copy and paste data into R from the clipboard?

旧巷老猫 提交于 2019-12-17 07:07:52
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 7 years ago . The title says it all: I have my data open in another application (e.g., a spreadsheet, like Excel, or a text editor). If I copy that data to my operating system clipboard, how can I read it into R as a data.frame? 回答1: Assuming you have data in the Windows clipboard (for example, copied data from Excel), to put that data into a variable named copdat in R use: copdat <- read

javascript copy rich text contents to clipboard

我的未来我决定 提交于 2019-12-17 06:40:14
问题 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 = corp.createTextRange() txt.execCommand("Copy") } else setTimeout("window.status=''", 5000) } <div id="sc1">hello <br> <b> world </b> </div> <button onclick="ctrlA1(document.getElementById('sc1') )"></button> Problem The aforementioned code isn't working and is resulting in an