Hi everyone,
I have started using Everlog for my journals and Things for my tasks.
My day note in Drafts use the following format:
09:00 AM First set of things
- Something
- Something else
10:00 AM second set of things
- [ ] a task
- [ ] a task
02:00 PM More things
I have a modified version of the Bullet Journaling action that can move the tasks to Things. I am trying to make journal entries in Everlog, one per block (either of a time entry and its notes or a task entry). So for the above example, I want to have three journal entries:
First:
First set of things
- Something
- Something else
Second:
second set of things
- [ ] a task
Third:
- [ ] a task
Fourth:
More things
I need to capture entries by timestamps or by - [ ] that have a preceding empty line.
The code in the existing action joins all the journal entries precluding the tasks. I need help in changing it to meet my use case above.
Here is what I currently have:
const draftLines = draft.content.split("\n");
const tags = draft.tags;
const EverLogURL = "everlog://newEntry"
const thingsURL = "things:///add";
var EverLogLines = [];
// Actions for sending journal entries to various apps
function collectForEverLog(entry) {
EverLogLines.push(entry);
}
function sendToThings(entry) {
var cb = CallbackURL.create();
cb.baseURL = thingsURL;
cb.addParameter("title", entry);
cb.addParameter("tags", tags);
cb.open();
}
var actionMap = {
"EverLog": collectForEverLog,
"Things": sendToThings,
}
var actions = {}
for (var key in lineProcessors) {
var actionName = lineProcessors[key];
actions[key] = actionMap[actionName];
}
for (var line of draftLines) {
line = line.trim();
if (line.length == 0) { continue; }
first = line[0];
rest = line.substr(1).trim();
if (rest.length == 0) { continue; }
action = actions[first];
if (action === undefined) { continue; }
action(rest);
}
if (EverLogLines.length) {
var body = EverLogLines.join("\n");
var cb = CallbackURL.create();
cb.baseURL = EverLogURL;
cb.addParameter("content", body);
cb.addParameter("tags", tags);
cb.waitForResponse = false;
cb.open();
}
script.complete();
The Everlog URL needs to be modified to everlog://newEntry?content=test&date=yyyy-mm-ddThh:mm:ss for entries with timestamps.
It has become a bit overwhelming for me to modify the script further. Posting here if I can get a sense of how to fix it.
Thanks