[Solved] Newbie question: Journaling Extended . Combine Reminder and other actions

hello,
is it possible to perform action on a line only (or line by line) on a multi-lined draft?

TIA

The answer to what you want to do is “Yes”, but I do think a clarification might help you get a better understanding of actions and what they do.


Actions

Actions run either on the current draft, or one by one on a selected group of draft (batch operation), each draft being taken in turn as the ‘current’ draft.

Now it is the content of the action that determines what actually happens.

You can write an action that when run, runs against a current draft, but never does anything with or to it, but instead works with another specific draft, or the clipboard, or creates a new workspace. Similarly, the content of the action could be set to work on each line of a draft.

Asking to perform a Drafts action on each line of a draft doesn’t make sense in terms of what actions are, instead we can say an action can do something to each line in a draft.

Processing by Line

One of the common ways to do this is to use JavaScript to split the draft up by splitting on every new line character. This creates an array of lines, and you can process each array element (a line) in a loop to do something with it.

You could also create an action to do something with the line of text that the cursor is currently on.

Examples

There are many actions in the directory that do things with the current line or process a draft line by line.

But the key, as always, is what you actually want to do with/to the line. You may find something in the directory that already does it. Alternatively, if you need help creating something, then you have probably come to the right place, but you would need to provide the details.

Hope that helps.

2 Likes

Thanks
I’ll study a bit and I’ll be back

Just to be. a little clearer… to send line 1 to a reminder and line 2 (of the same draft) to dropbox journal what should I do?

TIA

If it is always line 1 to reminders and always line 2 to Dropbox, you don’t even need any scripting, just to use the line template tag in the standard steps for reminders and Dropbox file saving.

E.g.

taking your action as an example how could I add let’s say reminder at a certain date/day…,
in other words how could I edit yours to master a little more Drafts?

You would swap out the first action for a script action and then write a script to create the reminder. This is because the basic reminder step does not support anything beyond a basic reminder.

You can find the Drafts documentation for scripting of a reminder here.

You could still use the line template. Lookup the processTemplateTag function for the Draft object. Buy you probably also want to think about where your date/time comes from.

Thanks
I’ll study a bit and I’ll be back :slight_smile:

You can see examples of people using this in the actions directory too, so you don’t necessarily need to start from scratch :wink:

what I like to achieve basically is to use (sometimes) Drafts as a diary, one draft a day with many different lines that in turn can become a reminder, a note, an appointment… and so on

Am I imagining something not in the spirit of Dratfs or can I tailor D to my needs?

Drafts could be made to work that way with actions which worked with specific lines, yes, I would tend to say it’s fighting against the more natural way to do that in Drafts, which would just be to have each of those things be their own draft.

That way each time you have something you want to capture, whether it’s a diary entry, an appointment, whatever, you just launch Drafts, type it and move on with your life, without needing to open the right draft, and find an insertion point, etc.

Then when you are ready to process the day’s entries, open the inbox and work through each snippet, performing actions to send it to it’s final destination - often with those actions configured to automatically archive the draft to get it out of the inbox.

Thanks Greg!

there is a way to group (export) together all the snippets of a single day…?

There is an action group ‘Quick Journaling’ worth having a look at. It allows entries to be built up during the day then processed once
to calendar, task manager and journal based on the leading character on each line.

2 Likes