The method of setting and getting clipboard contents by VBScript
In Automation, programs are often needed to interact with the clipboard, and an input is still being used on the keyboard. If there is a lot of content, isn't it too slow to use the paste copy of the clipboard, so fast,so easy … Specifically, you need to call the objects and methods of Microsoft Forms 2.0 Object Library to easily set and obtain the contents of the clipboard. Here are two functions to set and get the contents of the clipboard. Call ~ directly when needed.
'operating clipboardFunction setClipboard (str)' setting clipboard's content Dim Form, TextBox Set Form = CreateObject ("Forms.Form.1") Set TextBox = Form.Controls.Add ("Forms.TextBox.1"). Object TextBox.MultiLine = True TextBox.Text = str TextBox.SelStart = 0 TextBox.SelLength = TextBox.TextLength TextBox.CopyEnd FunctionFunction getClipboard 'getting clipboard's content Dim Form TextBox Set Form = CreateObject ("Forms.Form.1") Set TextBox = Form.Controls.Add ("Forms.TextBox.1"). Object TextBox.MultiLine = True If TextBox.CanPaste Then TextBox.Paste getClipboard = TextBox.Text End IfEnd Function
More method reference links: http://demon.tw/programming/vbs-clipboard.html