clipboard

Set clipboard text via adb shell as of API level 11

元气小坏坏 提交于 2019-11-29 09:13:21
Before API level 11, it was possible to set the content of the clipboard by using the service program on the adb shell : service call SERVICE CODE [i32 INT | s16 STR] ... Options: i32: Write the integer INT into the send parcel. s16: Write the UTF-16 string STR into the send parcel. There were three integer codes to define the methods: 1 TRANSACTION_getClipboardText 2 TRANSACTION_setClipboardText 3 TRANSACTION_hasClipboardText For instance this command $ adb shell service call clipboard 2 i32 1 i32 1 s16 "Hello Android!" set the clipboard's content to "Hello Android!" . As of API level 11 the

Modify Clipboard content after copy event: JavaScript, jQuery

最后都变了- 提交于 2019-11-29 08:58:32
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 selectedText = selectedText.replace(/<\/?[^>]+(>|$)/g, ""); //Trying to set data in clipboard window

How to check if clipboard is empty of text?

独自空忆成欢 提交于 2019-11-29 07:54:21
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' This method or property is not available because the Clipboard is empty or is not valid." Very

Python: copying from clipboard using tkinter without displaying window

*爱你&永不变心* 提交于 2019-11-29 07:37:30
Running Python 3.4 on Windows 7. I need to copy what's stored in the clipboard to a variable in my python program. I've seen on Stack Overflow that that can be done either with pywin32 or tkinter. Since tkinter is part of the python standard library, I decided that that was the better of the two since the user won't have to install an external module. Here's the code for getting the clipboard data in tkinter: import tkinter number = tkinter.Tk().clipboard_get() This works fine except a blank tkinter window pops up every time this executes. 1) Why is this happening? Normally tkinter doesn't

flexbox adding newline to clipboard

三世轮回 提交于 2019-11-29 06:22:13
I'm working with a layout that uses flexbox. Works good so far but I have a problem with copying text to clipboard. Apparently, using flexbox seems to add a newline character after each child node It can be seen in the demo below, copying text "LabelMessage" works normally (paste it and it remains one-line). But if you add display:flex to container a newline is added after "Label" upon copying to clipboard What is causing this? Is there any way around it? Fiddle: http://jsfiddle.net/zv4mamtm/ $('.toggleFlex').on('click', function() { $('.container').toggleClass('flex') }) .container.flex {

Disable clipboard prompt in Excel VBA on workbook close

假装没事ソ 提交于 2019-11-29 06:07:34
I have an Excel workbook, which using VBA code that opens another workbook, copies some data into the original, then closes the second workbook. When I close the second workbook (using Application.Close ), I get a prompt for: Do you want to save the clipboard. Is there a command in VBA which will bypass this prompt? chris neilsen I can offer two options Direct copy Based on your description I'm guessing you are doing something like Set wb2 = Application.Workbooks.Open("YourFile.xls") wb2.Sheets("YourSheet").[<YourRange>].Copy ThisWorkbook.Sheets("SomeSheet").Paste wb2.close If this is the case

Javascript - Copy string to clipboard as text/html

空扰寡人 提交于 2019-11-29 05:32:01
问题 Is there a way in javascript to copy an html string (ie <b>xx<b> ) into the clipboard as text/html, so that it can then be pasted into for example a gmail message with the formatting (ie, xx in bold) There exists solutions to copy to the clipboard as text (text/plain) for example https://stackoverflow.com/a/30810322/460084 but not as text/html I need a non flash, non jquery solution that will work at least on IE11 FF42 and Chrome. Ideally I would like to store both text and html versions of

How to programmatically cut/copy/get files to/from the Windows clipboard in a system standard compliant form?

安稳与你 提交于 2019-11-29 05:01:22
How do I put a cut/copy reference to specific files and/or folders into the Windows clipboard so that when I open standard Windows Explorer window, go to somewhere and press Ctrl + V - the files are pasted? If I copy or cut some files/folders in Windows Explorer, how do I get this information (full names and whether they were cut or copied) in my program? I program in C# 4.0 , but other languages' ways are also interesting to know. I've got the 90% solution, reverse-engineered from the clipboard formats and my answer in this thread . You'll need to set two pieces of clipboard data. The list of

C# Backing Up And Restoring Clipboard

余生长醉 提交于 2019-11-29 04:26:47
I have a program that uses clipboard but I want to restore the clipboard to its former state after I am done with it. This is my code : IDataObject temp = Clipboard.GetDataObject(); //Some stuff that change Cliboard here Clipboard.SetText("Hello"); //Some stuff that change Cliboard here Clipboard.SetDataObject(temp); But it if I copy a text, and run this code, I get nothing on notepad. NOTE : I can't use Clipboard.Contains because I want to preserve the Clipboard EXACLY how it was before, even if the user copied a file. Andre Luus I cannot confirm whether this will work, but I see no reason

How to programmatically copy asynchronous dependent content to the clipboard following a click?

孤街浪徒 提交于 2019-11-29 03:49:39
I'm trying to programmatically use the execCommand in Chrome (Build 43) to copy the result of an asynchronous JSONP request to the clipboard. Here is a snippet of the logic : loadContent() function loadContent(callback) { $.getJSON('http://www.randomtext.me/api/lorem/p-5/10-20?&callback=myFunc',function(result){ console.log('result=',result.text_out); $("#container").html(result.text_out); if (callback) { callback(); } }); } function copyAjax() { loadContent(copy); } function copy() { var copyDivText = $('#container').text(); console.log('copyDivText=',copyDivText); executeCopy(copyDivText); }