hello,
is it possible to perform action on a line only (or line by line) on a multi-lined draft?
TIA
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 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.
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.
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.
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
You can see examples of people using this in the actions directory too, so you donât necessarily need to start from scratch
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.