Class clipboard
Clipboard functions. Copy, paste, get and set clipboard text and other data.
public static class clipboard
Remarks
This class is similar to the .NET System.Windows.Forms.Clipboard class, which uses OLE API, works only in STA threads and does not work well in automation scripts. This class uses non-OLE API and works well in automation scripts and any threads.
To set/get clipboard data of non-text formats, use class clipboardData; to paste, use it with clipboard.pasteData; to copy (get from the active app), use it with clipboard.copyData<T>.
Don't copy/paste in windows of own thread. Call it from another thread. Example in keys.send.
Namespace: Au
Assembly: Au.dll
Properties
Name | Description |
---|---|
text | Gets or sets clipboard text. |
Methods
Name | Description |
---|---|
clear() | Clears the clipboard. |
copy(bool, OKey, KHotkey, int) | Gets the selected text from the focused app using the clipboard. |
copyData<T>(Func<T>, bool, OKey, KHotkey, int) | Gets data of any formats from the focused app using the clipboard and a callback function. |
paste(string, string, OKey, KHotkey, int) | Pastes text or HTML into the focused app using the clipboard. |
pasteData(clipboardData, OKey, KHotkey, int) | Pastes data added to a clipboardData variable into the focused app using the clipboard. |
tryCopy(out string, int, bool, bool, OKey, KHotkey) | Calls clipboard.copy and handles exceptions. |
tryPaste(string, int, bool, bool, string, OKey, KHotkey) | Calls clipboard.paste and handles exceptions. |