clipboard

How does X11 clipboard handle multiple data formats?

本小妞迷上赌 提交于 2019-12-03 06:22:49
问题 It probably happened to you as well - sometimes when you copy a text from some web page into your rich-text e-mail draft in your favorite webmail client, you dislike the fact that the pasted piece has a different font/size/weight.. it somehow remembers the style (often images, when selected). How is it than that if you paste the same into your favorite text editor like Vim, there's no HTML, just the plain text? It seems that clipboard maintains the selected data in various formats. How can

Platform independent tool to copy text to clipboard

旧街凉风 提交于 2019-12-03 06:09:17
I am trying to write a function that copies a string parameter to the clipboard . I intend to use this in a Python script that I've been working on. This is what I have so far (found most this snippet on another stack overflow post): from tkinter import Tk def copy_to_clipboard(text): text = str(text) r = Tk() r.withdraw() r.clipboard_clear() r.clipboard_append(text) r.destroy() My problem is that when the script stops, the copied text is no longer on the clipboard. Is there any possible alternative or fix to this? Is there a good platform independent solution to my problem? Or will I have to

Listener for clipboard content change?

泪湿孤枕 提交于 2019-12-03 05:58:45
Is there a way to register a method so that it's automatically called as soon as the user ends "text selection mode" (thereby copying selection to clipboard)? I think you're looking for ClipboardManager.addPrimaryClipChangedListener() . Edit - this is for Android 3.0, and I don't see any other clipboard-related apis in the earlier levels. Also see the ClipboardManager docs in the copy and paste guide. If you are using Android 3.0 you can add a listener with ClipboardManager.addPrimaryClipChangedListener() . I need the exact same functionality. For the moment I'm solving this with android.text

.Net Core - copy to clipboard?

佐手、 提交于 2019-12-03 05:47:10
问题 Is it possible to copy something to the clipboard using .Net Core (in a platform-agnostic way)? It seems that the Clipboard class is missing, and P/Invoking isn't an option outside of Windows. 回答1: This project of mine (https://github.com/SimonCropp/TextCopy) uses a mixed approach of PInvoke and command line invocation. it currently supports Windows with .NET Framework 4.6.1 and up Windows with .NET Core 2.0 and up Windows with Mono 5.0 and up OSX with .NET Core 2.0 and up OSX with Mono 5.20

Dealing with deprecated android.text.ClipboardManager

偶尔善良 提交于 2019-12-03 05:37:18
android.text.ClipboardManager was deprecated since API level 11, and replaced with android.content.ClipboardManager ( source ). How do I write code that supports both cases? Importing android.content.ClipboardManager and using that works in 11+ but force closes in 10. Changing the import to android.text.ClipboardManager throws a bunch of deprecation warnings in 11+. How can I handle both cases smoothly? What do I need to import? Mike Crittenden I ended up just using the old way (android.text.ClipboardManager and the code from this answer ), along with a couple @SuppressWarnings("deprecation")

AngularJS copy to clipboard

廉价感情. 提交于 2019-12-03 05:00:49
Is there a way to make a copy button with a copy function that will copy all the contents of a modal and you can paste it to notepad marmor I needed this functionality in my Controller , as the text to be copied is dynamic, here's my simple function based on the code in the ngClipboard module: function share() { var text_to_share = "hello world"; // create temp element var copyElement = document.createElement("span"); copyElement.appendChild(document.createTextNode(text_to_share)); copyElement.id = 'tempCopyToClipboard'; angular.element(document.body.append(copyElement)); // select the text

Get CSV Data from Clipboard (pasted from Excel) that contains accented characters

蹲街弑〆低调 提交于 2019-12-03 04:46:38
问题 SCENARIO My users will copy cells from Excel (thus placing it into the clipboard) And my application will retrieve those cells from the clipboard THE PROBLEM My code retrieves the CSV format from the clipboard However, the if the original Excel content contains characters like ä (a with umlaut) then retrieved CSV string doesn't have the correct characters (ä ends up showing as a "square" for me) In comparison, if my code retrieves the Unicode text format from the clipboard everything works

Import assignment cannot be used when targeting ECMAScript 2015 modules

大兔子大兔子 提交于 2019-12-03 04:27:18
I'm trying to use the follwing line: import Clipboard = require('clipboard'); and I get the following error: [default] c:\xampp\htdocs\isitperfect\node_modules\angular2-clipboard\src\clipboard.directive.ts:2:0 Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. The error is in this line: import Clipboard = require('clipboard'); I tried: import * as Clipboard from 'clipboard'; and some other variations but couldn't figure out how to fix it. I'm using

Paste clipboard image to canvas

泄露秘密 提交于 2019-12-03 03:59:29
I have a canvas that i need the users to be able to paste an image onto. I would like this to be cross browser. I would like only to use html/javascript. I would also be willing to use a flash object. This works fine in Chrome, though as of yet I haven't been able to figure out how to get it to work in Firefox. You can use this jQuery plugin to detect clipboard pastes. I'll assume you know how to draw the image once you have the data from the clipboard. # jquery.paste_image_reader.coffee (($) -> $.event.fix = ((originalFix) -> (event) -> event = originalFix.apply(this, arguments) if event.type

How can I get the standard iPhone Copy bubble to appear on a UIImage?

人盡茶涼 提交于 2019-12-03 03:29:19
In iPhoto, I can simply hold my finger over an image to get a "Copy" popup (like the popup you see in text boxes). In my UIImageView's, this is not the case. How can I enable it? Brad Larson You can manually display the Cut / Copy / Paste menu using the UIMenuController class . For example, the following code will display the menu, centered on your image: [self becomeFirstResponder]; UIMenuController *copyMenuController = [UIMenuController sharedMenuController]; [copyMenuController setTargetRect:image.frame inView:self.view]; [copyMenuController setMenuVisible:YES animated:YES]; This assumes