So, I did post before also but as my question was quite unclear, give me one more chance to ask my question in a better way.
I am trying to integrate the Obsidian Tasks plugin and Reminder Plugin with the QuickAdd plugin. The thing is for a task I don’t always have a due date, scheduled date etc. So, when I use the Capture choice in QuickAdd and I don’t have these properties for a task, I have to give an empty input to the prompts resulting in a task to have multiple useless properties added such as " Invalid Date". To avoid this i wanted to make a Macro that will check if an input is empty and if so the property (such as due date) is not added to the task.
Being a beginner python programmer and no experience in JavaScript, I asked ChatGPT to write up the code for me. It generated the following code.
async function captureTask() {
const tag = await quickAddApi.inputPrompt("tag");
const taskName = await quickAddApi.inputPrompt("task name");
const reminderDateTime = await quickAddApi.datePrompt("reminder date and time", "YYYY-MM-DD HH:mm");
const dueDate = await quickAddApi.datePrompt("due date", "YYYY-MM-DD");
const scheduledDate = await quickAddApi.datePrompt("scheduled date", "YYYY-MM-DD");
const priority = await quickAddApi.suggester(["⏫", "🔼", "🔽", " "], ["High", "Medium", "Low", "None"]
);
let taskString = '';
if (tag) {
taskString += \
#${tag} `;
}
if (taskName) {
taskString += \
${taskName} `;
}
if (reminderDateTime) {
taskString += \
${reminderDateTime} `;
}
if (dueDate) {
taskString += \
${dueDate} `;
}
if (scheduledDate) {
taskString += \
${scheduledDate} `;
}
if (priority && priority !== " ") {
taskString += \
${priority};
}
return taskString.trim();
}
const taskString = await captureTask();
if (taskString) {
await quickAddApi.addToDailyNote(taskString);
}
When running the Macro nothing happens. Literally Nothing
Pls help me! Thank You!