app.command

app.command.CommandName()
app.command.CommandName { param1=value1, param2=value2, ... }

Executes the given command named CommandName with the specified parameters.

  • app.command.About [UI]
    • Opens the About Aseprite window
  • app.command.AddColor
  • app.command.AdvancedMode [UI]
    • Toggles the application's "Advanced Mode"
  • app.command.AutocropSprite
  • app.command.BackgroundFromLayer
    • Equivalent to using Convert To -> Background in the Layer's context menu
  • app.command.BrightnessContrast [*]
  • app.command.Cancel
    • Equivalent to pressing the Esc key
  • app.command.CanvasSize [*]
  • app.command.CelOpacity
  • app.command.CelProperties [UI]
    • Shows the Properties dialog for the active Cel
  • app.command.ChangeBrush [UI]
  • app.command.ChangeColor [UI]
  • app.command.ChangePixelFormat [*]
  • app.command.Clear
    • Clear the current active document
  • app.command.ClearCel
    • Clear the active cel in unlocked layers
  • app.command.ClearRecentFiles
    • Clear the recent files list
  • app.command.CloseAllFiles [UI]
    • Close all open files
  • app.command.CloseFile [UI]
    • Close the active file
  • app.command.ColorCurve [*]
  • app.command.ColorQuantization [*]
  • app.command.ContiguousFill
    • Changes the current tool to Contiguous Fill
  • app.command.ConvolutionMatrix [*]
  • app.command.CopyColors
  • app.command.CopyMerged
    • Copies the active sprite as a merged image to the clipboard
  • app.command.Copy
    • Performs a copy command on the current selection
  • app.command.CropSprite
  • app.command.Cut
    • Performs a cut command on the current selection
  • app.command.DeselectMask
    • Deselects the current mask
  • app.command.Despeckle [*]
  • app.command.DeveloperConsole [UI]
    • Opens the developer console (experimental)
  • app.command.DiscardBrush [UI]
    • Discard the active brush
  • app.command.DuplicateLayer
    • Duplicate the currently selected layer
  • app.command.DuplicateSprite [*]
  • app.command.DuplicateView [UI]
    • Duplicates the current workspace view
  • app.command.Exit [UI]
    • Instructs Aseprite to exit, the user will be prompted to save if any files are modified and it can be canceled
  • app.command.ExportSpriteSheet [*]
  • app.command.ExportTileset [*]
  • app.command.Eyedropper
    • Grabs the color under the current mouse position with the Eyedropper tool
  • app.command.Fill
    • Performs a foreground color fill on the current selection mask
  • app.command.FitScreen [UI]
    • Resets the zoom on the current view to fit the screen
  • app.command.FlattenLayers
  • app.command.Flip
  • app.command.FrameProperties [*]
  • app.command.FrameTagProperties [*]
  • app.command.FullscreenPreview [UI]
    • Opens the full screen preview
  • app.command.GotoFirstFrameInTag [UI]
  • app.command.GotoFirstFrame [UI]
  • app.command.GotoFrame [UI]
  • app.command.GotoLastFrameInTag [UI]
  • app.command.GotoLastFrame [UI]
  • app.command.GotoNextFrameWithSameTag [UI]
  • app.command.GotoNextFrame [UI]
  • app.command.GotoNextLayer [UI]
  • app.command.GotoNextTab [UI]
  • app.command.GotoPreviousFrameWithSameTag [UI]
  • app.command.GotoPreviousFrame [UI]
  • app.command.GotoPreviousLayer [UI]
  • app.command.GotoPreviousTab [UI]
  • app.command.GridSettings [UI]
    • Opens the grid settings window
  • app.command.Home [UI]
    • Opens the Home tab
  • app.command.HueSaturation [*]
  • app.command.ImportSpriteSheet [*]
  • app.command.InvertColor [*]
  • app.command.InvertMask
    • Inverts the current selection mask, or if there is none, selects all
  • app.command.KeyboardShortcuts [UI]
    • Opens the keyboard shortcut menu, use the search parameter to pre-fill the searchbar
  • app.command.Launch
    • Opens the given path in the desktop web browser as relative path to aseprite.org or a full URL
  • app.command.LayerFromBackground
    • Converts the active background layer to a regular layer
  • app.command.LayerLock
    • Toggles the lock of active layers
  • app.command.LayerOpacity
  • app.command.LayerProperties [UI]
    • Opens the Layer property window for the active layer
  • app.command.LayerVisibility
    • Toggles the visibility of the active layer
  • app.command.LinkCels
    • Links the selected cels together
  • app.command.LoadMask [*]
  • app.command.LoadPalette [*]
  • app.command.MaskAll
    • Selects all
  • app.command.MaskByColor [*]
  • app.command.MaskContent
    • Selects the content from the active sprite (like autocrop)
  • app.command.MergeDownLayer
    • Merges the active layer down
  • app.command.ModifySelection [*]
  • app.command.MoveCel [UI]
    • Finishes the move operation of a cel in the timeline
  • app.command.MoveColors
  • app.command.MoveMask
  • app.command.NewBrush [UI]
    • Create a new brush from the current selection/editor
  • app.command.NewFile
  • app.command.NewFrameTag [UI]
    • Shows the New Tag dialog for the selected frame range
  • app.command.NewFrame
  • app.command.NewLayer [*]
  • app.command.NewSpriteFromSelection
    • Creates a new sprite from the current selection mask
  • app.command.OpenBrowser [UI]
    • Open the given filename in the internal text browser
  • app.command.OpenFile
  • app.command.OpenGroup
    • Opens the active layer group
  • app.command.OpenInFolder
    • Opens the folder of the active sprite in the file explorer
  • app.command.OpenScriptFolder
    • Opens the Aseprite script folder in the file explorer
  • app.command.OpenWithApp
    • Opens the active sprite with the native app assigned to the format
  • app.command.Options [UI]
  • app.command.Outline [*]
  • app.command.PaletteEditor [UI]
    • Show the palette editor popup
  • app.command.PaletteSize [*]
  • app.command.PasteText [UI]
    • Opens the Insert Text dialog
  • app.command.Paste
    • Pastes the clipboard into the current active sprite/selection, at coordinates x and y (if given)
  • app.command.PixelPerfectMode
    • Toggles the "pixel perfect" freehand algorithm
  • app.command.PlayAnimation [UI]
    • Plays the sprite's animation, if any
  • app.command.PlayPreviewAnimation [UI]
    • Plays the animation in the preview window (enables it if it's not visible)
  • app.command.Redo
    • Equivalent to app.redo()
  • app.command.Refresh [UI]
    • Refreshes the user interface
  • app.command.RemoveFrameTag
    • Remove a tag by the given name or object id
  • app.command.RemoveFrame
    • Remove the selected or the current active frame(s) (only if there's more 1 frame total)
  • app.command.RemoveLayer
    • Remove the selected or current active layer(s) (only if there's more than 1 layer total)
  • app.command.RemoveSlice
    • Remove a slice by name or object id
  • app.command.RepeatLastExport [*]
    • Redoes the last export command
  • app.command.ReplaceColor [*]
  • app.command.ReselectMask
    • Re-selects a hidden selection mask
  • app.command.ReverseFrames
    • Reverses frames (only if there are 2 or more in the selected range)
  • app.command.Rotate
  • app.command.RunScript
    • Run a script given by the filename parameter - any other parameters are passed to the script.
  • app.command.SaveFile [*]
  • app.command.SaveFileAs [*]
  • app.command.SaveFileCopyAs [*]
  • app.command.SaveMask [*]
  • app.command.SavePalette [*]
  • app.command.ScrollCenter [*]
    • Center the editor viewport
  • app.command.Scroll [UI]
  • app.command.SelectTile [UI]
    • Select the tile under the mouse, with a selection mode (SelectionMode)
  • app.command.SelectionAsGrid
    • Set the grid bounds to the current selection mask
  • app.command.SetColorSelector [UI]
    • Changes the color selector to the type: "spectrum", "tint-shade-tone", "rgb-wheel", "ryb-wheel" or "normal-map-wheel"
  • app.command.SetInkType [UI]
  • app.command.SetLoopSection
  • app.command.SetPaletteEntrySize [UI]
    • Set the palette entry size to the given size (defaults to 7)
  • app.command.SetSameInk
    • Set the same ink for all tools
  • app.command.ShowAutoGuides
    • Toggles the "Show Auto Guides" preference
  • app.command.ShowBrushPreview
    • Toggles the "Brush Preview" preference
  • app.command.ShowExtras
    • Toggles the "Show Extras" preference
  • app.command.ShowGrid
    • Toggles the "Show Grid" preference
  • app.command.ShowLayerEdges
    • Toggles the "Show Layer Edges" preference
  • app.command.ShowOnionSkin
    • Toggles the "Onion Skin" preference
  • app.command.ShowPixelGrid
    • Toggles the "Show Pixel Grid" preference
  • app.command.ShowSelectionEdges
    • Toggles the "Show Selection Edges" preference
  • app.command.ShowSlices
    • Toggles the "Show Slices" preference
  • app.command.SliceProperties [UI]
    • Shows the slice properties window by name or id parameters, otherwise uses the selected slice(s)
  • app.command.SnapToGrid
    • Toggles the snap to grid property
  • app.command.SpriteProperties
    • Shows the sprite properties window
  • app.command.SpriteSize
  • app.command.Stroke
    • Performs a foreground color stroke fill on the current selection mask
  • app.command.SwitchColors [UI]
    • Swaps the current foreground/background colors around
  • app.command.SymmetryMode
    • Sets the symmetry mode orientation to one of "vertical", "horizontal", "right_diagonal" or "left_diagonal". Defaults to none, which turns the mode off
  • app.command.TiledMode
    • Sets the tiled to mode axis to one of "both", "x" or "y". Defaults to none, which turns the mode off
  • app.command.Timeline [UI]
    • Changes the timeline visibility with the parameters open, close and switch
  • app.command.TogglePreview [UI]
    • Toggles the visibility of the preview window
  • app.command.ToggleTimelineThumbnails
    • Toggles the timeline thumbnails preference
  • app.command.UndoHistory
    • Shows the undo history window
  • app.command.Undo
  • app.command.UnlinkCel
    • Equivalent to app.undo()
  • app.command.Zoom [UI]

Annotations

*[]** - Can have UI interactions, controlled by the ui parameter.

[UI] - Requires the UI to be present, cannot be used in --batch mode.

Error Handling

If the command fails to run or is disabled, it will return false. To check if a command is enabled and can be run, you can use app.command.[COMMAND NAME].enabled before calling it.

Source

If you cannot find a specific command, you might like to take a look at the gui.xml file which contains the definitions of menus / commands + the parameters.

To figure out the parameters of an undocumented command, you can:

  1. Choose a command (the CommandName part of app.command.CommandName) from gui.xml file ( <key command="CommandName" ...> or <item command="CommandName" ...>)
  2. If those <key>...</key> or <item>...</item> XML elements contain children elements like <param name="param-name1" value="param-value2" /> you can specify those parameters in Lua between { ... }, for example:
    app.command.CommandName { ["param-name1"]="param-value1", ["param-name2"]="param-value2" }
    

Another alternative is looking to the Aseprite source code:

  1. Choose the command you want to use and find its counterpart .cpp file in src/app/commands/ (e.g. app.command.CropSprite has the file cmd_crop.cpp)
  2. Find all places in the file where params.get is used, the strings in that function are the parameter names you need to use.
  3. When setting the parameters, you'll want to write the parameters as below because Lua does not accept hyphens in identifiers.
    app.command.CommandName { ["parameter-name"]="value", ["other-parameter-name"]="otherValue" }