Using the clipboard in WSH

How to get the text from the clipboard

set objIE = CreateObject("InternetExplorer.Application")
textFromClipboard = objIE.document.parentwindow.clipboardData.GetData("text")
WScript.Echo textFromClipboard

How to put the text into clipboard

textIntoClipboard = "Some text" & VbCrLf & "Some more text"

Set objIE = WScript.CreateObject("InternetExplorer.Application")
objIE.Navigate "about:blank"
Do Until objIE.ReadyState = 4
WScript.Sleep 100

objIE.document.ParentWindow.ClipboardData.SetData "text", textIntoClipboard

The detailed explanation could be found here.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.