Possible Duplicate:
How do I read text from the (windows) clipboard from python?
Is there a way in python or vb or .bat to copy text from clipboard and write to a file in utf-8 encoding?
Possible Duplicate:
How do I read text from the (windows) clipboard from python?
Is there a way in python or vb or .bat to copy text from clipboard and write to a file in utf-8 encoding?
There is no direct access to the clipboard without third-party COM objects. You can use a workaround to get its contents.
' Grab the contents of the clipboard
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")
strClipboard = objIE.document.parentwindow.clipboardData.GetData("text")
objIE.Quit
You can read more about this in my article Scripting the Clipboard Contents in WSH.
Once you have the contents, you can employ the help of .Net to encode it.
Set Encoder = CreateObject("System.Text.UTF8Encoding")
strClipboardB = Encoder.GetBytes_4(strClipboard) 'get bytes
Set Encoder = Nothing
I should warn you, I've never tested the clipboard method with UTF8 text. It should work, but I'm not sure off the top of my head how that class handles UTF8 characters.