Je me trouve présentement sur la côte du Finistère sud… La tempête Ciaran est en approche.
Je me trouve présentement sur la côte du Finistère sud… La tempête Ciaran est en approche.
This is a script for Drafts.
This list will be sorted by days:
Tuesday. Chicken
Monday. Pasta
Sunday. Tacos
Script:
// Draft lines are sorted according to the order of the days array
// In each line, the day name must be followed by a dot then a space
// if some lines have no day name, they are placed at the beginning of draft
let days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'].map(d => d + '.');
draft.content = draft.lines.sort(function(a, b) {return days.indexOf(a.split(' ')[0]) - days.indexOf(b.split(' ')[0])}).join('\n');
draft.update();
Published in the Draft directory.
This is a script for Drafts.
The script allows you to get all drafts with the date of today in the title, within the workspace “Today”.
The date is formatted this way : YYYY-MM-DD.
// first customize the workspace name
let todayWorkspaceName = 'Today';
// script
let workspace = Workspace.find(todayWorkspaceName);
// if you have load of drafts, you can filter them with a tag and uncomment the next line
// workspace.tagFilter = 'today';
workspace.queryString = 'title:' + strftime(new Date(), '%Y-%m-%d');
workspace.update();
app.applyWorkspace(workspace);
app.currentWindow.showDraftList();
Published in the Draft directory.
This is an action for Drafts.
This group of actions is version 2 of the Track time actions.
Its purpose is to track time in a single draft made of successive timestamped entries.
It’s also to track actions that are noted inside the draft and shared from there to other apps. Drafts basically is ‘where text starts’. These actions make Drafts also ‘where action starts’.
You’ll find the 3 actions of version 1:
There are 3 other buttons:
All the buttons are in the keyboard Track time v2. They automatically update the timestamps and durations of the previous and current entry.
This version 2 of Track time here is a demo of what can be done.
In my version, I have customized the following functions and integrated them into Track time v2:
And another action exports entries to Day One.
Sky is the limit!
Published in the Draft directory.
This is an action for Drafts.
I wrote these actions to track time in a single draft.
The draft is made of successive and chronological entries. The entries are separated by “***”. The first line of each entry is a timestamp (yyyy-mm-dd-day HH:MM) and displays the duration ( => HH:MM) to the next entry. You can edit the separator and the timestamp format at the beginning of the Init script (with ‘gearing’ icon).
The first action (with a ‘plus’ icon) creates a new timestamped entry right after the one where the cursor is (the current entry).
The second action (with a ‘clock’ icon) updates the timestamp of the current entry. When the cursor is not on the timestamp line, this action also inserts the time (HH:MM) in the entry.
The third action (with a ‘down arrow’ icon) moves the cursor to the very end of the draft. It’s useful when, while reviewing past entries, you want to write down a new entry.
Published in the Draft directory.
This is a script for Drafts.
This script creates a new entry in the current draft, right after the entry where the cursor is. The new entry includes a timestamp (YYYY-MM-DD-day hh:mm).
By default, the timestamps are sorted by date and time (i.e. in the last entry, it’s the current date and time, but if you insert an entry between two existing one, it’s the date and time of the following one).
The separator between entries is set in the ‘Init’ function.
Published in the Draft directory.
This is a script for Drafts.
This script creates a new entry in the current draft, right after the entry where the cursor is. The separator between entries is set in the ‘Init’ function.
Published in the Draft directory.
This is a script for Drafts.
The timestamp format is simply ‘hh:mm’ and is inserted right at the cursor location.
let loc = editor.getSelectedRange()[0],
now = new Date().toTimeString().slice(0, 5);
editor.setTextInRange(loc, 0, now);
editor.setSelectedRange(loc + 5, 0);
editor.setSelectedText('');
// activate is not required if the action is launched via a keyboard button
editor.activate();
Published in the Drafts directory.
This is a script for Drafts.
let len = draft.content.length;
// if needed, insert a new line at the end of draft
if (!draft.content.endsWith('\n'))
editor.setTextInRange(len, 0, '\n');
else
editor.setTextInRange(len, 0, '');
// activate is not required if the action is launched via a keyboard button
editor.activate();
Published in the Drafts directory.
This is a script for Drafts.
let [loc, len] = editor.getSelectedLineRange(),
str = editor.getTextInRange(loc, len),
icon = '🔘',
reminderList = 'Inbox', // pick the Reminders list you want
list = ReminderList.findOrCreate(reminderList),
reminder = list.createReminder();
reminder.title = str.trim(); // trim gets rid of end of line (\n), if any
reminder.notes = new Date().toISOString(); // date or whatever you want
reminder.update();
let newStr = icon + ' ' + str;
editor.setTextInRange(loc, len, newStr);
// move the cursor to the end of the edited line
editor.setSelectedRange(loc + newStr.trim().length, 0);
editor.setSelectedText('');
// activate is not required if the action is launched via a keyboard button
editor.activate();
Published in the Drafts directory.