Ability to Validate Clipboard Data
I have been able to create Java that works for this, but it would be awesome to see this as part of our tool kit of steps provided within Subject7 as well. :)
package com.subject7;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.rmi.AccessException;
public class clipboard_Helper {
/*public void getClipboardText() throws UnsupportedFlavorException, IOException {
String result = "";
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable contents = clipboard.getContents(null);
boolean hasStringText = (contents != null) && contents.isDataFlavorSupported(DataFlavor.stringFlavor);
if (hasStringText) {
try {
result = (String)contents.getTransferData(DataFlavor.stringFlavor);
System.out.println(result);
} catch ( AccessException ex) {
System.out.println(ex); ex.printStackTrace();
}
}
}*/
public static void main(String[] args) {
//getClipboardText();
System.out.println("resul");
}
}
1 comment
Sort by
Date
Votes
Please sign in to leave a comment.