Xshell Knowledge Base

Sending clipboard data line by line using a script file

Last modified: Thursday, January 24, 2013 11:05 PM

DESCRIPTION

This article explains how to send clipboard data line by line using a simple script file and Xshell script feature.



RESOLUTION

The following content sends clipboard data line by line. It can be useful if you have multiple lines of commands and want to check the result of each command:

Sub Main

xsh.Screen.Synchronous = true

Dim clpData, objIE, rlines

Set objIE = CreateObject("InternetExplorer.Application")

objIE.Navigate("about:blank")

clpData = objIE.document.parentwindow.clipboardData.GetData("text")

rlines = Split(clpData, VbCrLf, -1)



Dim i

For i = 0 to ubound(rlines) Step 1

xsh.Screen.Send rlines(i)

xsh.Session.sleep(100)

xsh.Screen.WaitForString VbCr

Next

xsh.Screen.Synchronous = false

End Sub

To download this script file, click here.




AFFECTED SOFTWARE

Xshell 4