I'm hoping there exists a quick hack that will tell me the length of a string contained in the windows clipboard. (if it is in fact a string).
It's not for any kind of production code, and I'm not tied to any particular language.
TIA
I'm hoping there exists a quick hack that will tell me the length of a string contained in the windows clipboard. (if it is in fact a string).
It's not for any kind of production code, and I'm not tied to any particular language.
TIA
In Java:
java.awt.datatransfer.Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
String content = (String) clipboard.getData(DataFlavor.stringFlavor);
int size = content.length();
Add additional error checking as required.
In python:
import ctypes
ctypes.windll.user32.OpenClipboard(None)
print len(ctypes.c_char_p(ctypes.windll.user32.GetClipboardData(1)).value)
ctypes.windll.user32.CloseClipboard()