Automate tasks with MilkScript.


Quickstart: Star/Unstar selected tasks

If your almost perfect task system needs something to star things up, the script below might be exactly what you're looking for.

How it works

  1. The script gets selected tasks.
  2. If none of the tasks start with ⭐️, it adds ⭐️ to the beginning of each selected task.
    ⭐️ Pick up the milk at the corner shop along the Milky Way
  3. Otherwise, it removes ⭐️ from the tasks.

Set it up

  1. Open the web app or desktop app.
  2. Click the MilkScript button at the top right, then click New...
  3. Copy the code below and paste it into the script editor.
const star = '⭐️';

const selectedTasks = rtm.getSelectedTasks();

if (selectedTasks.length === 0) {
  throw new Error("There are no selected tasks.");

const isStarred = selectedTasks.some(task => task.getName().startsWith(star));

selectedTasks.forEach(task => {
  if (isStarred) {
    task.setName(task.getName().replace(new RegExp(`^${star}`), '').trim());
  } else {
    task.setName(`${star} ${task.getName()}`);
  1. At the top left, click Untitled script.
  2. Enter a name for your script (e.g. Star/Unstar selected tasks), then close the script editor.

Try it out

  1. Select any number of tasks.
  2. Click the MilkScript button at the top right.
  3. Click the recently created script, then click Yes, run script.
  4. When the script execution completes, the tasks will become starred.
  5. Optionally, to collect tasks with a star, create Starred Smart List with the following criteria: name:⭐️