quickadd
quickadd copied to clipboard
[FEATURE REQUEST] Capture to any file by select filename in input textbox instead of setting
Is your feature request related to a problem? Please describe.
I want to capture idea/thought to different markdown pages, but currently I can only set one page for one command ( except the daily note which we could use a template like daily/{{DATE:gggg-MM-DD - ddd MMM D}}.md
)
Describe the solution you'd like A clear and concise description of what you want to happen.
in this example, we could add any content to any file under file's title #todo
, after insert, we could get result in filename.md
...
# todo
some_context #this line is add by quick-add
....
It would be much more convenient then select only one filename in Capture
setting
@chhoumann is there a workaround to this? Maybe by combining macro somehow?
Sure, @datavistics!
You could create a macro with this script:
module.exports = async (params) => {
const allMdFiles = params.app.vault.getMarkdownFiles();
const selectedFilePath = await params.quickAddApi.suggester(
allMdFiles.map(f => f.basename),
allMdFiles.map(f => f.path)
);
params.variables.path = selectedFilePath;
}
Call the script first, and then capture to the {{VALUE:path}}
variable.
So the macro looks like this:
I called the script ask_for_file.js
.
wow! thx for your reply! @datavistics @chhoumann its really helpful!
I take some time to understand how quick add's micro work and it works perfect!
I have a few question
- I wonder how to suggest files
alias
too not just file's base name? - can we add a feature to support dynamic
insert after
params as well? so basically we can use this script to add any content to any file under any line - ps: I have to change Capture format to
{{VALUE}} \n
in other to add a newline to avoid just add content to already exist line's ending. Is this a deliberate design?
@chhoumann seriously THANKS so much. Thats amazing. If I ever meet you Ill give you a big hug.

If we can use macro directly in capture filename, it could be much convenient .