Howto:Clipboard access using Nasal
Jump to navigation
Jump to search
This article is a stub. You can help the wiki by expanding it. |
As of 08/2012 (i.e. in upcoming FlightGear 3.0), there's a "clipboard" hash in Nasal space which can be used to access the clipboard. There are two types of clipboards supported:
- CLIPBOARD: Standard clipboard like on almost everything operating system
- SELECTION: Primary X Selection like found on X11 based systems. On non-X11 platform this clipboard is only accessible from inside FlightGear.
# Setting/getting the contents of the given type of clipboard. If
# no type is specified it defaults to the standard clipboard.
# The return value indicates whether the operation completed
# successfully.
clipboard.setText: func(text, type = clipboard.CLIPBOARD) : bool
clipboard.getText: func(type = clipboard.CLIPBOARD) : bool
Some examples of using the clipboard:
print("Clipboard contains: ", clipboard.getText() );
print("Selection contains: ", clipboard.getText(clipboard.SELECTION) );
if( !clipboard.setText("test") )
print("Failed to write to clipboard");
if( !clipboard.setText("test-selection", clipboard.SELECTION) )
print("Failed to write to selection");