You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
763 B

3 years ago
<%*
const listName = await tp.system.suggester(["Groceries", "Health", "Household"], ["Groceries", "Health", "Household"])
let tempResult = "";
let num = 0;
const {update} = this.app.plugins.plugins["metaedit"].api;
const {getPropertyValue} = this.app.plugins.plugins["metaedit"].api;
let itemList = await getPropertyValue(listName, tp.file.find_tfile("@Shopping list"))
for (let i = 0; i < itemList.length; i++) {
let amount = itemList[i].split(" ")[0] + " " + num.toString();
let radicale = itemList[i].replace(itemList[i].split(" ")[0] + " " + itemList[i].split(" ")[1], "");
if (!i) {
tempResult = amount + radicale
} else
tempResult = tempResult + ", " + amount + radicale
}
}
await update(listName, tempResult, tp.file.find_tfile("@Shopping list"));
3 years ago
%>