Home » Support » Tutorials/Power Tips » UltraEdit » Scripting Access to the Clipboard

IDM PowerTips

UltraEdit/UEStudio Scripting Access to the Clipboard Contents

UltraEdit/UEStudio offer a powerful scripting engine which allows you to automate frequent tasks. Among the many UltraEdit/UEStudio specific functions, the scripting engine also includes a function to retrieve the contents of the clipboard.

If you are not yet familiar with the scripting functionality in UltraEdit/UEStudio, please click here to view the introduction to scripting Power Tip.


Clipboard Commands

The scripting engine is built on a JavaScript framework, the clipboard commands are therefore a JavaScript array object which is a property of the UltraEdit application object.

Unless other parameters are noted, the Clipboard Object commands are generally invoked using the following format:

UltraEdit.commandName();

The Clipboard Commands include the following: clipboardContent, clearClipboard, clipboardIdx, and selectClipboard.


clipboardContent

This command returns the contents of the active clipboard; however, you can also set/replace the contents of the clipboard.

Get the contents of the clipboard in a variable:

var clip = UltraEdit.clipboardContent;

Set the contents of the clipboard:

UltraEdit.clipboardContent = "Hello World!";

Append to the contents of the clipboard:

UltraEdit.clipboardContent += " Hello World!";

Modify the contents of the clipboard:

var clip = "Start -- " + UltraEdit.clipboardContent + " -- End";
UltraEdit.clipboardContent = clip;

clearClipboard

The clearClipboard command clears the contents of the active clipboard.

UltraEdit.clearClipboard

clipboardIdx

This command returns the index of the active clipboard. For example, if you are using user-clipboard number 3, the property would return "3".

Note: This is a READ ONLY property, you cannot set the Clipboard number with this command. Use the "selectClipboard" command to set/change the active clipboard.

var clipnum = UltraEdit.clipboardIdx;

selectClipboard

The selectClipboard command sets the active clipboard. You can specify a Clipboard number from 0-9.

Note: 0 = the Windows clipboard and 1-9 specifies user clipboards.

UltraEdit.selectClipboard(2);