This page describes the Anki Script default command syntax.
All command parameters may be quoted using either single or double quotes. ...
If quotes are present the outermost ones are removed, so 'value' and value are equivalent.
When a command parameter specifies a list of values the items in the list are separated using a comma, and each item is stripped of the outermost quotes like for single values. So, for example, , so 'value1', 'value2' and value1,value2 are equivalent.
Blank lines
Lines consisting only of whitespace are ignored.
Comments
#
Lines starting with '#' are comments.

#----------------------------
# install required addins
#----------------------------
Display message
display message: {message}
This command displays a message to the user.
display message: adding verb data
Open help page
open {name} help page
This command opens one of the addon's help pages.
open main help page
A help page name of 'main' can be used to refer to 'index.html'.
For ad-hoc scripts, or if the addon did not specify a location for help pages, the command is ignored.
Perform menu action
click {name} menu item
This command performs a menu action
click "Courses.Anki Script example custom syntax.Verb Aspects" menu item
A dot '.' is used to separate sub-menus.
Set alias value
set {name} alias, asking {prompt}, with default {default}
This command displays a prompt to the user and sets an alias value.
set verbs alias, asking 'Deck for learning verbs', with default 'Anki Script::example'
If the user selects 'Cancel' in the popup dialog the script execution is abandoned.
Install addon
install addin {id} ({name})
This command installs an addon from AnkiWeb.
install addin 1984823157 (Audio Files)
If the addon has already been installed this command is ignored.
The user is prompted to agree with the installation. The id must be the addon id shown on the AnkiWeb site, and the 'Help' button on the confirmation dialog is linked to the addin's AnkiWeb page.
The name should be the name that Anki uses for the addon.
Configure an addon
configure {name} addin
This command replaces the configuration for an addon. The new configuration must be provided in the domain specific/course addon data .
configure "Audio Files" addin
The name should be the name that Anki uses for the addon.
Partially configure an addon
configure {name} addin, setting key {key}
This command replaces a subset of the configuration for an addon . The new configuration must be provided in the domain specific/course addon data
configure "Audio Files" addin, setting key "sources"
The name should be the name that Anki uses for the addon.
Copy a single file
copy {name} from {source} to {destination}
This command copies a single file from an addon internal directory .
copy _ankiscript_example.css from media to Anki media collection
The destination can be a directory alias, or 'Anki media collection' to specify that the file is to be copied into the Anki media directory.
Note that media files referred to by field values are automatically copied by Anki Script when the field value is set.
Create multiple decks
create decks {decks}
This command creates multiple decks.
create decks verbs, nouns
Create a single decks
create deck {deck}
This command creates a single deck.
create deck verbs
Add note
add {model} note, setting fields {fields}
This command adds a new note, setting values for multiple fields.
add verb note, setting fields Russian to думать, English to "to think", Audio to "[sound:думать.mp3]"
Tags may be set, and field values can contain HTML or media references .
Set fields values for an existing note
for {model} {note} set fields {fields}
This command sets multiple field values for an existing note.
for verb думать set fields:
    Russian (я) to думаю,
    Russian (ты) to думаешь,
    Russian (он/она/оно) to думает,
    Russian (мы) to думаем,
    Russian (вы) to думаете,
    Russian (они) to думают
Tags may be set, and field values can contain HTML or media references .
Set a field value for an existing note
for {model} {note} set field {field} to {value}
This command set a single field value for an existing note.
for verb думать set field Aspect to imp
Tags may be set, and field values can contain HTML or media references .
Change the default deck for a card template
set default deck to {deck} for {model} card type {template}
This command changes the default deck for a single card template.
set default deck to vocabulary for pronoun card type e>r (nom, m)
Note that the card template is referred to by its name, not position.
Change the default deck for multiple card templates
set default deck to {deck} for {model} card types {templates}
This command changes the default deck for a multiple card templates.
set default deck to vocabulary for pronoun card types e>r (nom, m), r>e (nom, m)
Note that the card templates are referred to by their name, not position.
Create a new note type
create {model} note type and {commands}
This command creates a new note type.
create verb note type and:
    add fields Russian, Audio, English;
    add card types e>r, r>e, setting default deck to verbs
This command must have at least one sub-command as at least one field and one card template must be defined for the note type.
Parameters may be used in sub-commands.
Refer to for how to specify styling.
Create a new cloze note type
create {model} cloze type and {commands}
This command creates a new cloze note type.
create declension cloze type and add fields Russian, English
This command must have at least one sub-command as at least one field must be defined for the note type. Note that as Anki automatically creates card templates for cloze note types no card templates can be added.
Parameters may be used in sub-commands.
Refer to for how to specify styling.
Edit a new note type
change {model} note type and {commands}
This command changes a note type.
change verb note type and add field Aspect
This command must have at least one sub-command.
Parameters may be used in sub-commands.
Note that if a new styling is defined the note type styling is updated. Refer to for how to specify styling.
There may be multiple sub-commands, separated by a semi-colon ';' and for readability they may be placed on a new line.
The sub-commands used when creating or changing note types are:
Define parameters
with {parameters}
Defines parameters values to use when creating fields and card templates.
change verb note type and:
    with PERSON in [я, ты, он/она/оно, мы, вы, они];
Refer to for details about using parameters.
Translate parameters
translate {name} to [{values}]
Defines parameter translations to use when creating card templates.
change verb note type and:
    with PERSON in [я, ты, он/она/оно, мы, вы, они];
    translate PERSON to [I, you, he/she/it, we, you, they];
Refer to for details about using parameters and translations.
Add new field
add field {field}
Add a new field to the note type.
change verb note type and:
     add field Aspect;
Add new fields
add fields {field}
Add new fields to the note type.
change verb note type and:
     add fields Aspect, Pair;
Add new card template
add card type {template}, setting default deck to {deck}
Add a new card template to the note type.
create verb note type and:
    add card type e>r, setting default deck to verbs
Refer to for how to define the card template contents.
Add new card templates
add card types {templates}, setting default deck to {deck}
Add new card templates to the note type.
create verb note type and:
    add card types e>r, r>e, setting default deck to verbs
Refer to for how to define the card template contents.
Edit card template definition
change card type {template}
Changes a card template definition.
change verb note type and:
     change card type e>r
Refer to for how to define the card template contents.
Edit card template definitions
change card types {templates}
Changes multiple card template definitions.
change verb note type and:
     change card types e>r, r>e
Refer to for how to define the card template contents.