Macro: Change properties in your daily notes (requires MetaEdit)
This macro lists every property in today’s daily journal note in a menu. Pick one, type a new value, and the macro writes it back - a quick way to update a property without opening the note or editing frontmatter by hand.
Before you start
Section titled “Before you start”- The MetaEdit plugin must be installed and enabled. This macro calls MetaEdit’s
getPropertiesInFileandupdatefunctions.
- Save the script below to a
.jsfile somewhere in your vault (not inside the.obsidianfolder). See the user scripts guide for how QuickAdd loads scripts. - In QuickAdd settings, click Add Choice, select Macro, and name it (for example,
Change property). See the Macro choice docs for a full walkthrough. - Click the configure button (the gear icon) to open the Macro Builder, then add your script as a User Script command.
- Edit the script to point at your own daily notes:
- Change the date format from
gggg-MM-DD - ddd MMM Dto match your daily notes’ file names. - Change the path from
bins/daily/to wherever your daily notes live.
- Change the date format from
Run the macro, choose a property from the menu, and enter its new value.
If you already know which properties you want to change and don’t want to be asked about the rest, replace the suggester’s property list with a plain array of property names. You’d pass that array to the suggester method instead.
module.exports = async (params) => { const {quickAddApi: {inputPrompt, suggester}} = params; const {update, getPropertiesInFile} = app.plugins.plugins["metaedit"].api; const date = window.moment().format("gggg-MM-DD - ddd MMM D"); const dailyJournalFilePath = `bins/daily/${date}.md`;
const propertiesInDailyJournal = await getPropertiesInFile(dailyJournalFilePath); const targetProp = await suggester(propertiesInDailyJournal.map(p => p.key), propertiesInDailyJournal);
const newPropertyValue = await inputPrompt(`Log ${targetProp.key}`, targetProp.content, targetProp.content);
await update(targetProp.key, newPropertyValue, dailyJournalFilePath);}