#
hs.pasteboard
Inspect/manipulate pasteboards (more commonly called clipboards). Both the system default pasteboard and custom named pasteboards can be interacted with.
This module is based partially on code from the previous incarnation of Mjolnir by Steven Degutis.
#
Submodules
#
API Overview
Functions - API calls offered directly by the extension
allContentTypes callbackWhenChanged changeCount clearContents contentTypes deletePasteboard getContents pasteboardTypes readAllData readArchiverDataForUTI readColor readDataForUTI readImage readPListForUTI readSound readString readStyledText readURL setContents typesAvailable uniquePasteboard writeAllData writeArchiverDataForUTI writeDataForUTI writeObjects writePListForUTI
#
API Documentation
#
Functions
#
allContentTypes
#
callbackWhenChanged
#
changeCount
#
clearContents
#
contentTypes
#
deletePasteboard
#
getContents
#
pasteboardTypes
#
readAllData
#
readArchiverDataForUTI
#
readColor
#
readDataForUTI
#
readImage
#
readPListForUTI
#
readSound
#
readString
#
readStyledText
#
readURL
#
setContents
#
typesAvailable
#
uniquePasteboard
#
writeAllData
#
writeArchiverDataForUTI
#
writeDataForUTI
#
writeObjects
| | |
| --------------------------------------------|-------------------------------------------------------------------------------------|
| Signature | hs.pasteboard.writeObjects(object, [name]) -> boolean
|
| Type | Function |
| Description | Sets the pasteboard contents to the object or objects specified. |
| Parameters |
- object - an object or table of objects to set the pasteboard to. The following objects are recognized:
a lua string, which can be received by most applications that can accept text from the clipboard
hs.styledtext
object, which can be received by most applications that can accept a raw NSAttributedString (often converted internally to RTF, RTFD, HTML, etc.)hs.sound
object, which can be received by most applications that can accept a raw NSSound objecths.image
object, which can be received by most applications that can accept a raw NSImage object a table with theurl
key and value representing a file or resource url, which can be received by most applications that can accept an NSURL object to represent a file or a remote resource a table with keys as described inhs.drawing.color
to represent a color, which can be received by most applications that can accept a raw NSColor object an array of one or more of the above objects, allowing you to place more than one object onto the clipboard. - name - an optional string indicating the pasteboard name. If nil or not present, defaults to the system pasteboard.
- true or false indicating whether or not the clipboard contents were updated.
- Most applications can only receive the first item on the clipboard. Multiple items on a clipboard are most often used for intra-application communication where the sender and receiver are specifically written with multiple objects in mind.