Intercept paste event in Javascript

You can intercept the paste event by attaching an “onpaste” handler and get the pasted text by using “window.clipboardData.getData(‘Text’)” in IE or “event.clipboardData.getData(‘text/plain’)” in other browsers. For example: var myElement = document.getElementById(‘pasteElement’); myElement.onpaste = function(e) { var pastedText = undefined; if (window.clipboardData && window.clipboardData.getData) { // IE pastedText = window.clipboardData.getData(‘Text’); } else if (e.clipboardData && … Read more

How can I “intercept” Ctrl+C in a CLI application?

Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { /* my shutdown code here */ } }); This should be able to intercept the signal, but only as an intermediate step before the JVM completely shutdowns itself, so it may not be what you are looking after. You need to use a SignalHandler (sun.misc.SignalHandler) to intercept the … Read more

Copy Paste Values only( xlPasteValues )

If you are wanting to just copy the whole column, you can simplify the code a lot by doing something like this: Sub CopyCol() Sheets(“Sheet1”).Columns(1).Copy Sheets(“Sheet2”).Columns(2).PasteSpecial xlPasteValues End Sub Or Sub CopyCol() Sheets(“Sheet1”).Columns(“A”).Copy Sheets(“Sheet2”).Columns(“B”).PasteSpecial xlPasteValues End Sub Or if you want to keep the loop Public Sub CopyrangeA() Dim firstrowDB As Long, lastrow As Long … Read more