Show/Hide Toolbars

EmEditor Help

Navigation: EmEditor Help > Macro Reference > clipboardData Object > Methods

Macro: getData Method

Scroll Prev Top Next More
EmEditor Home - EmEditor Help - EmEditor Macro Reference - clipboardData Object

getData Method

Retrieves the data in the specified format from the Clipboard.


sData = clipboardData.getData( sDataFormat, iPos );


sData = clipboardData.getData( sDataFormat, iPos )



String that specifies one or more of the following data format values.


Specifies the text format.


Specifies the line text format.


Specifies the box text format.


Specifies the HTML format.


Optional. Specifies the position in the Clipboard history if you want to retrieve older clipboard data. If this is -1 or omitted, the current data is retrieved. This value must be 0 or -1 if "html" is specified in the sDataFormat parameter.



str = clipboardData.getData("Text");


str = clipboardData.getData("Text")

The following macro displays the clipboard history, and selecting an item will insert that text.


menu = CreatePopupMenu();

i = 0;

do {

   str = clipboardData.getData("text", i);

   if( str.length == 0 ) break;

   str = str.substr( 0, 40 )

   menu.Add( str, i + 100 );


} while( 1 );


result = menu.Track( 0 );

if( result != 0 ) {

   s = clipboardData.getData("text", result - 100);

   document.write( s );


The following macro pastes the clipboard contents as HTML format.


str = clipboardData.getData("html");

document.selection.Text = str;


Supported on EmEditor Professional Version 5.00 or later.

Copyright © 2003-2022 by Emurasoft, Inc.