I’m interested in using the functionally in the “List in Reminders” action step, but as a script. Is there a script version of this action step? I’m mostly interested in setting a delimiter so that what follows is saved in the notes of the Reminder.
You should be able to build one based on the functionality listed under Reminders List, Reminder and some general line processing code.
BUT, isn’t what you are asking for exactly what the delimiter option in the list in reminders action is for? Is there something else you are wanting to do script-wise that you haven’t described above that would necessitate using a script over the standard action?
Yes, the action does what I want it to in terms of the delimiter. But I want to integrate that post-delimiter-to-reminder-notes functionality into a script that already works nicely for me.
I figure I’d need to use loc and len, but I haven’t been able to make heads or tails of these things in all of the example scripts I’ve payed with, for this or other scripting projects.
How about grab the contents, split by new lines, for each line run a function that processes the line for reminders.
That processing function you then build around those objects above. You could use further splitting perhaps or a string ‘match’ function to get what you are after?
Seems like a sound approach. Each line I’m interested in - those that count as Tasks - start with “”, so that makes it easier.
Yes. Once you have used something like say draft.content.split("\n");
to return your array of lines, you can then do a regular expression match or simply just compare the first few characters (substring) for a task line, and then keep building it up from there.
Ok, can you help get me started with the delimiter? How do you say in javascript, put everything after said delimiter, and up to the end of the line, into a variable?
If I say to you that new line characters (\n
) are separating the string of text that is your draft content and you can split that into lines as per the above, does that give you any ideas as to how to split a line?