clipboard

Why show java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String?

心已入冬 提交于 2019-12-18 14:43:11
问题 When copying String from any browser page, pasteData works properly. However when copying SpannedString from a message sent item editor(field), the application crashes and shows this error message: java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String My code: // since the clipboard contains plain text. ClipData.Item item = clipBoard.getPrimaryClip().getItemAt(0); // Gets the clipboard as text. String pasteData = new String(); pasteData = (String) item

In chrome, using the window.Clipboard object, is there a way to capture pasted text?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 13:16:39
问题 You can capture an image. I am trying to figure out how to capture text. I'm guessing there isn't, for security reasons, but I wanted to make sure. Also is there a reference for this stuff? window.Clipboard object isn't part of the v8 engine, it's a part of the chrome browser and I can't find official documentation for it. 回答1: In the code you linked there is a pasteHandler function with the following: // Get the items from the clipboard var items = e.clipboardData.items; if (items) { // Loop

Copying to clipboard with document.execCommand('copy') fails with big texts

我怕爱的太早我们不能终老 提交于 2019-12-18 11:56:24
问题 I'm using a hidden text area to put some text, select it and then using document.execCommand to copy it to the clipboard. This usually works but fails (returns false) when the text is large. In Chrome v55, it seems to fail around 180K characters. Is there a limit to the amount of data that can be copied this way? Normal Ctrl+C doesn't seem subject to the same limitations. note: someone marked this as a possible duplicate of Does document.execCommand('copy') have a size limitation?. It might

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

别来无恙 提交于 2019-12-18 11:07:44
问题 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 ? 回答1: You can use the paste.exe software in order to paste text just like you are describing. http://www.c3scripts.com/tutorials/msdos/paste.html With it you can do: paste | command to paste the contents of the windows clipboard into the input of the specified command

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

三世轮回 提交于 2019-12-18 11:07:01
问题 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 ? 回答1: You can use the paste.exe software in order to paste text just like you are describing. http://www.c3scripts.com/tutorials/msdos/paste.html With it you can do: paste | command to paste the contents of the windows clipboard into the input of the specified command

Integrate readline's kill-ring and the X11 clipboard

橙三吉。 提交于 2019-12-18 10:42:51
问题 In my .zshrc , I use the following snippet to integrate the shell's clipboard and my primary X11 clipboard. Thanks to this integration, I can cut-and-paste text to and from emacs, firefox, and the terminal without having to use the mouse. kill-line() { zle .kill-line ; echo -n $CUTBUFFER | xclip -i } zle -N kill-line # bound on C-k yank() { LBUFFER=$LBUFFER$(xclip -o) } zle -N yank # bound on C-y Note: I use this trick on mac os x as well (with pbcopy/pbpaste instead of xclip) and thanks to

Vim and matlab GUI - Emulate matlab Run (<F5>) with Vim

馋奶兔 提交于 2019-12-18 10:27:27
问题 I'm using linux and gvim/vim as external editor for matlab. Using matlab editor you can run a file by pressing F5. I'm trying to reproduce this with gvim-gtk(official debian packages). I know it is possible to direct filename or selection to matlab in "bash mode" like the following: execute '!echo "' ."run(\'".expand("%:p")."\')" . '"| matlab -nojvm' execute '!matlab -nodisplay < '.expand("%:p") noremap <C-CR> :?%%?;/%%/w !matlab -nojvm But I want to use the Matlab gui (which in my case is

java/swing: clipboard paste

。_饼干妹妹 提交于 2019-12-18 09:24:48
问题 I have a DropTargetListener setup to allow me to drag + drop strings into some tables of my Swing application -- on a drop, I parse the string and insert data into the table. I would like to do the same thing with a clipboard paste (Ctrl-V). What literature is there to explain how to handle clipboard pastes? I'm looking at some stuff from Sun's website and it seems bizarre, like this should be simpler. 回答1: This answer by Bozhidar Batsov is the best solution I have seen around, simple and

Copy binary data to clipboard

放肆的年华 提交于 2019-12-18 08:50:34
问题 How can I copy binary data in the clipboard? For example if I pack the number 1 as a 4-byte little-endian integer I want my clipboard to show 00 00 00 01 For text data this is trivial, with the option of having unicode text or ascii text. Clipboard.SetData(DataFormats.Text, "Some text"); Clipboard.SetData(DataFormats.UnicodeText, "赤"); However for binary data I don't know what to do. 回答1: There are actually two ways to do this: First one, and by far the simplest one: you simply put the byte

How to paste a custom format clipboard data into a TMemo?

こ雲淡風輕ζ 提交于 2019-12-18 07:09:22
问题 This question refers to this one along with its accepted answer posted here on stackoverflow. I don't feel comfortable at Windows API programming. Exploring the way EasyGPS by Topografix handles clipboard manipulations, I discovered that it uses a custom clipboard format named GPX wich is actually plain XML text (GPX to be precise). Using Clipboard.AsText is excluded. I stumble at this stage: program ProbeClipboard; {$APPTYPE CONSOLE} uses SysUtils, Windows, ClipBrd; var CF_GPX: Cardinal;