Created By  inflectra.sarahx Thursday, September 13, 2018

Sometimes when automating a test, you need to access the local Windows clipboard. This article describes how to access the Windows clipboard programmatically.

There are a couple special libraries that contains useful things.  These include: g_util and g_helper.  It just happens that the g_util library has a method to get the existing clipboard contents:

var myText = g_util.GetClipboardText();

To copy value from Rapise to clipboard use

g_util.SetClipboardText("Elephant");

To see some of the other useful methods, one can add the g_util or g_helper string to their code window followed by a period (.) and a list of all the methods should pop open.

NOTE: If the script has not yet been saved, this “auto-list” functionality will not be available until the user saves, closes and reopens the script.

 

RVL

To use clipboard in RVL put these functions into *.user.js file.


function CopyToClipboard(/**string*/ value)
{
    g_util.SetClipboardText(value);
}

function CopyFromClipboard()
{
    return g_util.GetClipboardText();
}

The following snippet puts a value into clipboard, then reads it and prints to the report.

 

Attachments

Selected files will be attached to any email sent on saving ticket.

file selected files selected  () Delete Selected

  • Created:
  • by:

Select files to upload

Or drag and drop files here

Uploading …
Done!
Upload More?
There was an error.
Try again?

Save to upload the selected file(s)

Article Info
  • Last Updated: 9/13/2018
  • Article ID: KB68
  • Views: 2463