Just reopened Drafts to find a blank draft when you were expecting to continue working on your previous one? Forgot to turn on focus mode? Just hit ⌘O to quickly open your most recently accessed draft. You can download this action from the Action Directory and read more
on my blog.
really nice idea, thanks for sharing!
I used your idea to build a script which will build a prompt from the last 10 (configurable) draft titles and I can select one of them to be loaded into the editor.
Here is the script:
// open recent draft from prompt
let recentDraftsArray = Draft.query('', 'all', [], [], 'accessed', true, false)
const recentDraftCount = 10;
let mostRecentDrafts = [];
for (let i = 0; i < recentDraftCount; i++) {
mostRecentDrafts.push(recentDraftsArray[i]);
}
var p = Prompt.create();
p.title = "select draft";
for (var d of mostRecentDrafts) {
p.addButton(d.title, d.uuid);
}
var con = p.show();
if (con) {
let recent = Draft.find(p.buttonPressed);
editor.load(recent)
// action goes here
} else {
context.cancel();
}
Really nice suggestion! Thanks for this. You’ve also reminded me to add to my blog post about another way to get a list of recent drafts: ⌘\ then right arrow key. You can then use the arrow keys to choose a draft and hit enter to open.
maybe another idea here:
the app.selectDraft()
API has a really nice interface, too.
It does not offer any options nor does it have an “all” tab, but I send a request for that and maybe this will be added in the future.
Didn’t know about that! Thanks for point pointing it out.
Thank you for this! Super useful.
I modified it slightly to easily pull something back from the archive:
Draft.query(’’, ‘archive’, [], [], ‘accessed’, true, false)
Works great!