Trigger an event when clipboard content changes

Have you thought about using an endless loop and “sleeping” between tries? I used pyperclip for a simple PoC and it worked like a charm, and Windows and Linux. import time import sys import os import pyperclip recent_value = “” while True: tmp_value = pyperclip.paste() if tmp_value != recent_value: recent_value = tmp_value print(“Value changed: %s” … Read more

Copy and paste clipboard in JavaScript. or jQuery

It is not easy but possible: function copyToClipboard(meintext) { if (window.clipboardData) window.clipboardData.setData(“Text”, meintext); else if (window.netscape) { netscape.security.PrivilegeManager.enablePrivilege(‘UniversalXPConnect’); var clip = Components.classes[‘@mozilla.org/widget/clipboard;1’].createInstance(Components.interfaces.nsIClipboard); if (!clip) return false; var trans = Components.classes[‘@mozilla.org/widget/transferable;1’].createInstance(Components.interfaces.nsITransferable); if (!trans) return false; trans.addDataFlavor(‘text/unicode’); var str = new Object(); var len = new Object(); var str = Components.classes[“@mozilla.org/supports-string;1”].createInstance(Components.interfaces.nsISupportsString); str.data=meintext; trans.setTransferData(“text/unicode”,str,meintext.length*2); var clipid=Components.interfaces.nsIClipboard; if (!clipid) … Read more

How to handle a blocked clipboard and other oddities

Another workaround would be to use Clipboard.SetDataObject instead of Clipboard.SetText. According to this MSDN article this method has two parameters – retryTimes and retryDelay – that you can use like this: System.Windows.Forms.Clipboard.SetDataObject( “some text”, // Text to store in clipboard false, // Do not keep after our application exits 5, // Retry 5 times 200); … Read more

HTML5 alternative to flash-based ZeroClipboard for safe copying of data to clipboard?

The reasoning is that automatic copying to clipboard can be very dangerous, thus most browsers (except IE)* make it difficult unless you use flash. Much like your ZeroClipboard, there is Clipboard LMCButton which also uses a small flash script running in the background. A common solution would be to do this: function copyToClipboard (text) { … Read more

.Net Core – copy to clipboard?

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.1 and up Linux with .NET Core … Read more

Add content of showModalDialog() to the clipboard Google Script

You can create a textarea in html and copy data in it to clipboard using a button inside html. Snippet: copy.html: <textarea id=”copy”><?=temp?></textarea> <button>Copy</button> <script type=”text/javascript”> let t = document.getElementById(‘copy’); let copy = () => { t.select(); document.execCommand(‘copy’); }; copy();//try copying without user click let bt = document.querySelector(‘button’); bt.addEventListener(‘click’, copy); </script> code.gs //Output to Html … Read more

Webcam usage in C#

I’ve recently started doing some hobby work in this area. We settled on using the OpenCV library with the opencvdotnet wrapper. It supports capturing frames from a webcam: using (var cv = new OpenCVDotNet.CVCapture(0)) { var image = cv.CreateCompatibleImage(); // … cv.Release(); } And if you’re doing image manipulation, OpenCV’s image processing algorithms have been … Read more