Reading from and writing to the system clipboard

To read the operating system clipboard, call the getData() method of the Clipboard.generalClipbooard object, passing in the name of the format to read:

if(air.Clipboard.generalClipboard.hasFormat("text/plain")){ 
    var text = air.Clipboard.generalClipboard.getData("text/plain"); 
}

To write to the clipboard, add the data to the Clipboard.generalClipboard object in one or more formats. Any existing data in the same format is overwritten automatically. However, it is a good practice to also clear the system clipboard before writing new data to it to make sure that unrelated data in any other formats is also deleted.

var textToCopy = "Copy to clipboard."; 
air.Clipboard.generalClipboard.clear(); 
air.Clipboard.generalClipboard.setData("text/plain", textToCopy, false);
Note: Only code running in the application sandbox can access the system clipboard directly. In non-application HTML content, you can only access the clipboard through the clipboardData property of an event object dispatched by one of the HTML copy or paste events.