clipboard

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

六月ゝ 毕业季﹏ 提交于 2019-12-17 04:34:14
问题 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

Copying to the clipboard in Java [duplicate]

家住魔仙堡 提交于 2019-12-17 04:22:28
问题 This question already has answers here : Copying text to the clipboard using Java (4 answers) Closed 10 months ago . I want to set the user's clipboard to a string in a Java console application. Any ideas? 回答1: Use the Toolkit to get the system clipboard. Create a StringSelection with the String and add it to the Clipboard . Simplified: StringSelection selection = new StringSelection(theString); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents

Copying to the clipboard in Java [duplicate]

心不动则不痛 提交于 2019-12-17 04:22:27
问题 This question already has answers here : Copying text to the clipboard using Java (4 answers) Closed 10 months ago . I want to set the user's clipboard to a string in a Java console application. Any ideas? 回答1: Use the Toolkit to get the system clipboard. Create a StringSelection with the String and add it to the Clipboard . Simplified: StringSelection selection = new StringSelection(theString); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents

Get text from clipboard using GetText - avoid error on empty clipboard

喜欢而已 提交于 2019-12-17 04:01:41
问题 I'm using code like this to get text from off the Clipboard. Dim DataObj As New MSForms.DataObject DataObj.GetFromClipboard myString = DataObj.GetText I use error handling to get the past the case where the Clipboard is empty, and everything is fine as long as I keep Error Trapping set to Break on Unhandled Errors. However, for unrelated reasons I want to set Error Trapping to Break on All Errors, and this throws an error at DataObj.GetText when it finds the empty Clipboard. Is there any kind

Copy selected text to the clipboard WITHOUT using flash - must be cross-browser

谁说我不能喝 提交于 2019-12-17 03:59:42
问题 I want to have a button which selects the text in a textarea and copies it to the clipboard. I can't seem to find any solutions which work in all browsers and don't use flash. Surely this is doable? I've seen it all over the place but I guess they use flash, which I really want to stay away from if possible as some people don't have it. This is what I have so far - it just selects the text: function copyCode() { $("#output-code").focus(); $("#output-code").select(); } (The focus is not

How to copy to clipboard in Vim?

不想你离开。 提交于 2019-12-17 02:56:08
问题 Is it possible to copy to clipboard directly from Vim? yy only copies stuff to Vim's internal buffer. I want to copy to the OS's clipboard. Is there any such command in Vim or you can only yank stuff within Vim? 回答1: The * register will do this. In Windows, + and * are equivalent. In unix there is a subtle difference between + and * : Under Windows, the * and + registers are equivalent. For X11 systems, though, they differ. For X11 systems, * is the selection, and + is the cut buffer (like

Copy to clipboard using Javascript in iOS

爱⌒轻易说出口 提交于 2019-12-17 02:33:48
问题 I'm using this function to copy a URL to the clipboard: function CopyUrl($this){ var querySelector = $this.next().attr("id"); var emailLink = document.querySelector("#"+querySelector); var range = document.createRange(); range.selectNode(emailLink); window.getSelection().addRange(range); try { // Now that we've selected the anchor text, execute the copy command var successful = document.execCommand('copy', false, null); var msg = successful ? 'successful' : 'unsuccessful'; if(true){ $this

ubuntu vim复制到系统剪切板

徘徊边缘 提交于 2019-12-16 13:50:09
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 问题描述:在vim写完ACM代码后,需要把代码复制到剪切板中,从而上传到判定网站,但是使用命令 sudo apt-get install vim 安装的vim不支持这样的操作。 问题原因:安装vim不支持xtem_clipboard,无法复制到+寄存器 解决方案:安装vim-gnome或者vim-gtk sudo apt-get install vim-gnome 进入vim,使用命令 ggVG"+y 即可将全文复制到剪切板。 参考链接: http://blog.fooleap.org/using-vim-with-clipboard-on-archlinux.html http://vim.wikia.com/wiki/Accessing_the_system_clipboard 链接中有关于+和*寄存器的详细描述。 来源: oschina 链接: https://my.oschina.net/u/251879/blog/208701

C#/WPF: Can I Store more that 1 type in Clipboard?

戏子无情 提交于 2019-12-14 04:25:09
问题 Can I Store more than 1 type in the Clipboard? Eg. like Text & Image. say the user pastes in a text editor, he gets the text and if he pastes in something like photoshop, he gets the image. I thought it was possible but I tried Clipboard.Clear(); Clipboard.SetText(img.DirectLink); BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.UriSource = new Uri(img.DirectLink); bitmapImage.EndInit(); Clipboard.SetImage(bitmapImage); and I always get the image 回答1: Yes, it

Blogger: Added Javascript but no result came out

吃可爱长大的小学妹 提交于 2019-12-14 04:14:20
问题 First I edited my Blogger Template HTML. I added the following script in the footer-1 section: <script type="text/javascript"> //<![CDATA[ var copyTextareaBtn = document.querySelector('.js-textareacopybtn'); copyTextareaBtn.addEventListener('click', function(event) { var copyTextarea = document.querySelector('.js-copytextarea'); copyTextarea.select(); }); var copyTextareaBtnb = document.querySelector('.js-textareacopybtnb'); copyTextareaBtnb.addEventListener('click', function(event) { var