Integerating Obsidian Tasks with QuickAdd

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 " :date: 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 += \:alarm_clock: ${reminderDateTime} `;

}

if (dueDate) {

taskString += \:date: ${dueDate} `;

}

if (scheduledDate) {

taskString += \:hourglass_flowing_sand: ${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!

did you put it inbetween

\ ```js quickadd

at the start of the capture box and

```

at the end of the box?

I am using a user script with Macro. Do i need to ass “js quickadd” here also. I thought it was only for inline scripts.

I cant use inline scripts because it does not allow to take in date inputs. Only text inputs are allowed in inline scripts