Help with a conditional action

Hello, I’m pretty new to Drafts.

I’d like to create a conditional action. If the Draft has only one line of text, do a), but if it has multiple lines of text, do b).

Is there an easy way to achieve this?

Thanks,

Andy

Scripted actions can do more or less anything to evaluate conditions. Not sure what your different outcomes would be, but the logical condition you describe could be scripted like:

let lines = draft.content.split("\n");
if (lines.length == 1) {
  // do a
}
else {
  // do b
}

Thanks, that’s really helpful.

Is it possible for ‘a’ and ‘b’ to be different action steps?

(In my case, ‘a’ is to action a single URL, whereas ‘b’ would give the user the option of two URLs to choose from.)

Thought it might be helpful for me to give more background!

If I have just one line in my drafts, I want it to be sent to Things as a single task.

But if I have multiple lines, I want to be able to choose whether it goes as a single task (with everything after the first line being a note attached to the task), or as multiple tasks (a new task for each line).

I have the three URLs lined up ready to use, but I just don’t know how to chain them together logically in Drafts.

Thanks!