How do I create a quickadd command to add specific properties to my files?

What I’m trying to do

I am trying to add specific properties to my existing files without damaging any pre-existing text, and without having to type in the property every time.

Things I have tried

I have a feeling it’s possible with the QuickAdd plugin. I have tried experimenting with the templater and the capture options. I managed to get the capture command to add properties if the file was completely blank, by just having it add:

“—

property:

  • [text]

–“

at the top of the file, where it rendered as a property. This doesn’t work if there is text above it.

I have also tried adding the actual property text under the pre-existing line:

“Source:”

But that didn’t work.

The only thing I’ve found that works is using the templater feature, but I don’t like this because then I have to add a separate file of that template into my obsidian folder. For every property I want to add. Which is quite a few.

Anyway. I don’t really understand the QuickAdd plugin (and I have absolutely no grasp on coding, whatsoever), but I assume this is something that it can do? If someone could explain to me (in very simple terms) either how to do it, or why the plugin won’t perform this function, I would greatly appreciate it.

Thanks.

I’m pretty sure what you’re trying to do is feasible using Templater and Obsidian API but you might not necessarily need one template per properties you would like to add (e.g.: Zachatoo’s snippet to update frontmatter in 1 note)…
It’s probably also feasible with QuickAdd too and some other “scripting” plugins out there :blush:

But I think you could also achieve this (at least, to some extend, depending on your exact needs) using a base :blush:

I mean, with a base, you could list all the notes in your vault (or only some by adding a filter), create the needed key(s) through the Properties menu at the top (which also allows you to select the appropriate type for said key(s)), display the new key(s) in the base and enter the value you want to add to the new key(s) in at least one of the notes… and then, copy/paste that value into the other cells in the same column :blush:

It’s a bit more “manual” than using a “script” but if you’re trying to add the same value to some notes somewhat quickly without having to write a script, it does the job :blush: (regardless of the absence/presence of frontmatter and the note’s content)

Now, I don’t know if this will really fit your use case though :innocent: … But I just thought it could be worth mentioning this alternative :blush:

Edit: Another possible alternative which I always forget about (:sweat_smile:) could be the plugin Multi Properties

Yes, and there is an even lesser known one, File/Files Cooker, which has a plus: you can limit the pool of files you want to add a property to with a DataView query.

1 Like

These suggestions are really helpful, thank you!

1 Like

Hi! Thanks for your answer and recommendation. I’ve installed the plugin to experiment with it in a sandbox vault but I can’t figure out how to use it to add properties in this way. Would you mind running through the steps for an example of what you mean?

Thank you!

Apparently there are lots of commands available with File Cooker if you have already targeted your notes you want to add props to:

Screenshot is from this video:

Never mind that in this the person wants to move files. Somewhere in there the logic and exact steps will be found how to add properties in batch as well.

Some plugins are very minimal, some overwhelming.

Look, did you try to make templates of your properties?

You only need Obsidian’s default template plugin for this to work.

Create a note with all the properties you need and put it into your templates folder.

You can apply multiple property templates if you prefer modularity.

You might want to look at the Linter plugin. In the YAML settings, you can input a list of properties to be added to every note. If you open an existing note, it will then add any missing properties. The only part I’m not sure about is if there’s a way to lint all your existing notes in a batch without having to open them.

The problem with Linter is that you can either lint one note, all notes or notes in a folder.
The other two plugins mentioned are more superior because both or either can limit scope on Obsidian Core Search results and DataView results (File Cooker). Don’t ask me now which; anybody wants to use them, check docs of these plugins.