Search code examples
vbscriptpowershell-2.0clipboardclipkeystroke

SEND clip as keystrokes


I am just wondering if there is any way in manner of PSH or VBS to paste/SEND the text from clipboard as separate keystrokes rather then string????

It is VERY important, since I have to do some automatic search in web UI drop down lists and passing text by CTRL+V simply does not work. So I need to send each letter as unique keystrokes.

Tried to find some way and searched over the Internet but no luck.

Thank you in advance


Solution

  • There are a few ways to interact with the clipboard in VBScript. Here's one way to read clipboard text:

    strText = CreateObject("htmlfile").ParentWindow.ClipboardData.GetData("text")
    

    Once you have the text, you could simply send each letter in sequence:

    For i = 1 To Len(strText)
        SendKeys Mid(strText, i, 1)
    Next