app.clipboard

A set of functions to handle the clipboard.

When calling a function with clipboard write access in a script, Aseprite will ask the user if they want to allow the function to run or stop the script.

security popup

app.clipboard.text

local text = app.clipboard.text

Gets or sets the clipboard text. Returns nil if there is no text.

app.clipboard.image

local image = app.clipboard.image

Gets or sets the clipboard image. Returns nil if there is no image.

app.clipboard.content

local content = app.clipboard.content

Gets the content of the clipboard, as a table. Values:

  • image: An image object or nil
  • selection: A selection object or nil
  • palette: A palette object or nil
  • tileset: A tileset object or nil
  • text nil nil String String of selected colors in hex codes, seperated by \n

Depending on what is copied, each value will be set differently. Case table:

An image is copied in Aseprite An image is copied externally Text is copied A portion of the Palette is copied
image Image Image nil nil
selection Selection nil nil nil
palette Sprite palette nil nil nil
tileset nil nil nil nil
text nil nil String String of selected colors in hex codes, seperated by \n

app.clipboard.hasText

local hasText = app.clipboard.hasText

Returns true if the last item copied to the clipboard was text.

app.clipboard.hasImage

local hasImage = app.clipboard.hasImage

Returns true if the last item copied to the clipboard was an image.

app.clipboard.clear()

app.clipboard.clear()

Clears the clipboard.