Scripting Overview
QuickAdd scripts are JavaScript files that run inside Obsidian. They can ask you for input, call Obsidian’s own APIs, read data from other plugins, and hand values back to a Macro. This page helps you pick which kind of script to write, then points you at the detailed guides.
You don’t need to be a programmer to use scripting, but you do need to be comfortable pasting and lightly editing JavaScript.
Which one do I want?
Section titled “Which one do I want?”| Need | Use | Why |
|---|---|---|
| A reusable script with settings | User script | Best for larger workflows and shared code |
| A small transformation inside a template or capture | Inline script | Keeps tiny logic close to the format using it |
| Several script and choice steps in sequence | Macro choice | Coordinates order, variables, and abort behavior |
| A script users can configure from the QuickAdd UI | Script with settings | Lets non-coders change values without editing JavaScript |
What a user script looks like
Section titled “What a user script looks like”Every user script exports one function. QuickAdd calls it with a params
object and waits for it to finish:
module.exports = async (params) => { const { app, quickAddApi, variables } = params; const title = await quickAddApi.inputPrompt("Title");
variables.title = title; return title;};The params object is how your script reaches everything it needs:
app: the Obsidian app instancequickAddApi: QuickAdd’s prompt, utility, AI, and execution helpersvariables: values shared across macro steps
How a value travels through a macro
Section titled “How a value travels through a macro”When a macro runs several steps, they pass values to each other through the
shared variables object:
- A choice or script asks for a value.
- QuickAdd stores that value in
variables. - Later template, capture, and script steps can reuse it.
- If a prompt is cancelled, QuickAdd aborts the macro unless your script handles the cancellation.
Use named values like {{VALUE:project}} when several macro steps should share
one prompt.
A good order to learn this in
Section titled “A good order to learn this in”- Macro Choices for how macro steps are assembled.
- User Scripts for complete scripting patterns.
- Scripts with Settings for configurable scripts.
- QuickAdd API Reference for exact method details.
Debugging
Section titled “Debugging”Sprinkle console.log through a script while you build it, then read the output
in Obsidian’s developer console. Keep each script small enough that you can test
one step at a time before wiring it into a longer macro.