CLIPBOARD
The CLIPBOARD class provides methods to access the system clipboard. Because these are implemented as static methods, you do not need to create an instance of the class.
Methods
- Clipboard::Get (Retrieve the contents of the system clipboard)
- Clipboard::Set (Sets the system clipboard)
Examples
First copy some text from a different application on your system. Then enter the following commands to retrieve and print the current text:
result = Clipboard.Get()
print, result
Now add your own text to the system clipboard:
Clipboard.Set, "IDL is fun!"
You should now be able to paste this text into a different application on your system.
Clipboard::Get
The Clipboard::Get method returns the text from the system clipboard.
Syntax
Result = Clipboard.Get( )
Return Value
Returns a scalar string or string array containing the current contents of the system clipboard.
- If the clipboard is currently empty or does not contain text then an empty scalar string will be returned.
- If the system clipboard does not contain any newline characters then a one-element string array will be returned.
- If the system clipboard contains newline characters then a string array will be returned, with each element corresponding to a separate line of text. The newline characters (
\r
or\n
) are always removed from the result. - If the last line on the clipboard contains a newline, then an additional empty string will be returned as the last element. This allows you to determine whether the user included the newline on the end of their copy operation, or did not include the newline.
Arguments
None.
Keywords
None.
Clipboard::Set
The Clipboard::Set method sets the system clipboard to the value of a supplied scalar or array string argument.
Syntax
Clipboard.Set, Text
Arguments
Text
A scalar string or string array. If Text is a string array then the strings will be added to the system clipboard as a single string with the appropriate newline characters separating each string.
Keywords
None.
Version History
8.3 |
Introduced |