clipboard

Modify Clipboard content after copy event: JavaScript, jQuery

无人久伴 提交于 2019-11-27 22:47:48
问题 My requirement: When user copy some content from my web page, with text some HTML tags and carriage retun also gets copied. I need to modify the copied content in clipboard i.e. removing carriage retunn and HTML tags. What I have tried so far: I have captured the copy even using jQuery and get the content of clipboard. See below code. $(document).bind('copy', function () { //getting clipboard content var selectedText = window.getSelection().toString(); //removing carriage retun from content

How to check if clipboard is empty of text?

核能气质少年 提交于 2019-11-27 22:37:57
问题 If I try to paste from an empty clipboard, I get an error. I would like to check if the clipboard is empty of text before pasting so that I can avoid this. How can this be accomplished? I'm aware it can be done through error handling, but I would prefer a method that avoids an error. Edit -- Per request, adding code that creates the error and the error message: Code that causes the problem: Sub PasteFromEmptyClipBoard() Selection.Paste End Sub Error message that I get: "Run-time error '4605'

How to get Clipboard data in Chrome Extension?

我是研究僧i 提交于 2019-11-27 22:11:54
I'm having a hard time finding any recent info on how to add a listener for "Ctrl+C", fetching clipboard data, and then writing back to clipboard all in a Chrome Extension. All of the old code that i found was for the older versions that are now deprecated. Ivan Nevostruev Basically you can manipulate clipboard using document.execCommand('paste|copy|cut') . You'll need to specify "clipboardWrite" and/or "clipboardRead" permissions in manifest. "clipboardRead" Required if the extension or app uses document.execCommand('paste'). "clipboardWrite" Indicates the extension or app uses document

Clipboard size limit

独自空忆成欢 提交于 2019-11-27 21:00:56
Is there any limit of the size of data that can be copied to clipboard? I am using VB6 and need to copy blocks of data to the clipboard. Applications call GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE) to allocate the memory for data to be stored on the clipboard and make it available to other applications. For 32-bit applications GlobalAlloc can allocate blocks up to 2 GB in size or up to the amount of virtual memory the PC has, whichever is less. The Windows clipboard does not impose any other size limits. Most data is copied as a reference rather than the data itself so you can copy most

Copying stuff from vim running in putty

谁都会走 提交于 2019-11-27 20:17:17
问题 I am running Vim 6.3 through putty and putty connection manager. I have the mouse option set (set mouse = a). I am able to paste things from the (windows) clipboard to vim by but selecting text in vim isn't copying anything to the clipboard. Does anyone know how do I do this? Note: I can't update Vim to a newer version. 回答1: You can select some text with the mouse and then type: "*y to yank the selected text to the clipboard, then you should be able to use the clipboard content in another

Secret copy to clipboard JavaScript function in Chrome and Firefox?

落爺英雄遲暮 提交于 2019-11-27 19:51:14
问题 Update Looks like browsers are starting to support copy natively in JS In the console windows of both Chrome and Firefox on Mac I can execute copy("party in your clipboard!"); and the text gets copied to my clipboard. I have searched SO and Google and can't seem to find anything on this. Are these specific to each browser? Where can I find more information on these JavaScript functions? Browser versions: JavaScript returned from Chrome console when executing 'copy' function (object) { if

How to send data to local clipboard from a remote SSH session

偶尔善良 提交于 2019-11-27 19:41:31
问题 Borderline ServerFault question, but I'm programming some shell scripts, so I'm trying here first :) Most *nixes have a command that will let you pipe/redirect output to the local clipboard/pasteboard, and retrieve from same. On OS X these commands are pbcopy, pbpaste Is there anyway to replicate this functionality while SSHed into another server? That is, I'm using Computer A. I open a terminal window I SSH to Computer B I run a command on Computer B The output of Computer B is redirected or

Can Java system clipboard copy a file?

醉酒当歌 提交于 2019-11-27 19:28:55
问题 I've used Java system clipboard to transfer text and image, but I wonder if it can copy and paste files ? If so where can I find some sample code ? I found a similar question at : How can I copy a file and paste it to the clipboard using Java? But nowhere in it can I find the word "clipboard", and I don't know how to use it. The methods I use to copy image look like this : public static void setClipboard(Image image) // This method writes a image to the system clipboard : from exampledepot

OpenClipboard failed when copy pasting data from WPF DataGrid

旧巷老猫 提交于 2019-11-27 18:55:14
I've got a WPF application using datagrid. The application worked fine until I installed Visual Studio 2012 and Blend+SketchFlow preview. Now, when I'm trying to copy the data from the grid into the clipboard with Ctrl + C (in any application), I'm getting the following exception: System.Runtime.InteropServices.COMException (0x800401D0): OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN)) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32

Leave out quotes when copying from cell

耗尽温柔 提交于 2019-11-27 18:54:38
Problem : When copying a cell from Excel outside of the program, double-quotes are added automatically. Details : I'm using Excel 2007 on a Windows 7 machine. If I have a cell with the following formula: ="1"&CHAR(9)&"SOME NOTES FOR LINE 1."&CHAR(9)&"2"&CHAR(9)&"SOME NOTES FOR LINE 2." The output in the cell (formatted as number) looks like this in Excel: 1SOME NOTES FOR LINE 1.2SOME NOTES FOR LINE 2. Well and good. But, if I copy the cell into another program, such as notepad, I get annoying double-quotes at the beginning and end. Notice the tabs created by "CHAR(9)" are kept, which is good.