clipboard

Copy to Clipboard in Chrome Extension

怎甘沉沦 提交于 2019-11-26 21:53:51
I'm making an extension for Google Chrome and I have hit a snag. I need to copy a readonly textarea's content to the clipboard on click in the popup. Does anyone know the best way to go about this with pure Javascript and no Flash? I also have jQuery loaded in the extension, if that helps any. My current (non-working) code is... function copyHTMLCB() { $('#lb_html').select(); $('#lb_html').focus(); textRange = document.lb_html_frm.lb_html.createTextRange(); textRange.execCommand("RemoveFormat"); textRange.execCommand("Copy"); alert("HTML has been copied to your clipboard."); } serg You can

How to copy Images/files to clipboard in android? Any Alternative methods/steps to get this

十年热恋 提交于 2019-11-26 21:38:33
问题 I want to copy images/files to clipboard. I have googled it but i didn't find any alternative/suggestion to this. but i have seen some app's done in app store. want to know how can we achieve this. Any one please help me OR give me some suggestions? i found this link but now clue how to achieve this functionality. 回答1: For the details of how to copy/paste image/file in Android, read Android official document from here. In short, copy/paste image/file follows the below steps: The data source

How to get Clipboard data in Chrome Extension?

佐手、 提交于 2019-11-26 20:54:46
问题 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. 回答1: 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

Clipboard size limit

一世执手 提交于 2019-11-26 20:30:42
问题 This question was migrated from Super User because it can be answered on Stack Overflow. Migrated 10 years ago . 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. 回答1: 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

Access clipboard in Windows batch file

為{幸葍}努か 提交于 2019-11-26 20:24:45
Any idea how to access the Windows clipboard using a batch file? rojo 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 JScript solution below, but it does have the advantage of simplicity. Updated solution: Thanks Jonathan for pointing to the capabilities of the mysterious

Copy text string on click

丶灬走出姿态 提交于 2019-11-26 20:09:22
I spent a good 20 min searching online for this, but couldn't find it. What I want is to to be able to copy a text string on click without a button . The text string will be inside a "span" class. User hovers over text string User clicks text string Text string is copied to clipboard Any help would be greatly appreciated. Thanks! You can attach copy event to <span> element, use document.execCommand("copy") within event handler, set event.clipboardData to span .textContent with .setData() method of event.clipboardData const span = document.querySelector("span"); span.onclick = function() {

How do I monitor clipboard content changes in C#? [duplicate]

萝らか妹 提交于 2019-11-26 19:42:42
This question already has an answer here: Clipboard event C# 9 answers I want to have this feature in my C# program: When the user do Ctrl + C or Copy anywhere (i.e. when the clipboard content changes), my program will get notified, and check whether the content met certain criteria, if so, become the active program, and process the content, etc. I can get the contents out from System.Windows.Forms.Clipboard , however, I don't know how to monitor the content changes from the clipboard. If using Windows Vista or later, use AddClipboardFormatListener as in John Knoeller's answer, for Windows XP,

Python script to copy text to clipboard [duplicate]

試著忘記壹切 提交于 2019-11-26 19:37:39
This question already has an answer here: How do I copy a string to the clipboard on Windows using Python? 17 answers I just need a python script that copies text to the clipboard. After the script gets executed i need the output of the text to be pasted to another source. Is it possible to write a python script that does this job? robert See Pyperclip . Example (taken from Pyperclip site): import pyperclip pyperclip.copy('The text to be copied to the clipboard.') spam = pyperclip.paste() Also, see Xerox . But it appears to have more dependencies. On mac i use this function. import os data =

Paste an image from clipboard using JavaScript

久未见 提交于 2019-11-26 19:27:34
How do we paste an image from clipboard into a custom rich text editor using javascript? (ctrl+c and ctrl+v or a snapshot). Has anyone used Ajax's rich text editor? Does pasting an image from clipboard to Ajax RTE work? Please do share your thoughts! Thanks! Because this question still often shows up in Google's search results, I want to point out this is possible today, at least in Google Chrome (2011) in all modern browsers (2018). They implemented it to use in GMail, but it is available for all websites. How does the paste image from clipboard functionality work in Gmail and Google Chrome

How do I backup and restore the system clipboard in C#?

巧了我就是萌 提交于 2019-11-26 19:09:05
I will do my best to explain in detail what I'm trying to achieve. I'm using C# with IntPtr window handles to perform a CTRL-C copy operation on an external application from my own C# application. I had to do this because there was no way of accessing the text directly using GET_TEXT. I'm then using the text content of that copy within my application. The problem here is that I have now overwritten the clipboard. What I would like to be able to do is: Backup the original contents of the clipboard which could have been set by any application other than my own. Then perform the copy and store