POLL: What services would you like to see added to Drafts?

I was beginning to consider pulling something together in Python 3 - but this contribution of yours gets us, arguably, to where we need to be.

(I still might, particularly to offer a chance to modify the title line before creating the draft. And possibly doing some tagging.)

Good question, that I haven’t thought much about. Here are just some brief ideas (completely open to suggestion and change).

On one hand there may be files with standardized format that I want to be a bit careful about. On the other hand Drafts is so flexible and customizable that it is easy to standardize a workflow if wanted. Depending on the type av file there may be other options as well.

  1. Highly standardized formatted files (e.g. crontab) may be left as is but distinguished by an appropriate tag.
  2. Since several programming languages (Bash, Zsh, Python, Perl, osascript etc.) needs a ‘shebang’ with # in the first line it would be safest to reserve that for the title in drafts—or create a highly structured workflow taking care of that (but at he expense of higher uncertainty).
  3. Since # is used for headings in Markdown and comments there may be other plausible choices for titles in other files or ‘scratch pads’.

Thank you @Sylymer, exactly the pipe I was looking for!

1 Like

Thanks for the post. I want to first say thank you so much for a such a great application. Drafts is fantastic and is my probably the most opened app on my phone. I would like to know if it would be possible to provide a post to tumblr action to the directory like there is a Wordpress option now?

I use Draft as my primary writing starting point and would to love to be able to post directly.

PS. I thought there might be a way to do this with Apple shortcuts and if someone has a good way to do it with that then I would rescind my request.

Thanks again.

The Tumblr app has a share extension which can be used with the “Share” action in Drafts to post. I do not know if they have any Shortcuts support in their app.

1 Like

What a Happy New Year—thanks to Drafts, @agiletortoise, @sylumer, @martinpacker and others!

Since I also wanted to open the created draft with sylumer’s pipe I added that possibility too. You may argue if you really want that option already inside the script or separately but I went for this ‘inside’ solution:

osascript 
 | sed 's/ id /s:open?uuid=/' | xargs open

(This means that whenever I pipe something to Drafts the newly created draft is immediately opened. Remember that osascript returns something like

draft id D54CEF20-7E82-47B9-91B0-001371347AA3

that we must parse, so I just replaced ' id ' with 's' and the action 'open?uuid=' to get the appropriate link.)

N.B.

I discovered in previous attempts that it was not straightforward to extract the draft id or permalink in AppleScript or coerce the result into various data types but I found out I could—in fact—use the error itself(!) to get it right. (Kids, don’t try this at home! :grinning:)

❧

try
. . . id of the result
on error msg
. . . set AppleScript’s text item delimiters to “\”"
. . . set myID to text item -2 of msg
. . . open location “drafts:open?uuid=” & myID
end try

1 Like

In case it helps anyone, I’ve built this one script out a little bit to a small set of scripts with some broader functionality. I’ve tested them a bit, but I wouldn’t say it’s been rigorous testing (more a bit of light unit testing).

The script to create a draft will accept content via piped input, and tags as attributes. There’s a second, very similar, script that will do the same, but also flag the newly created draft. They both output just the UUID of the created draft now - i.e. without the draft id prefix.

I’ve also added an open draft (based on UUID - which you could get from those previous scripts), script to append/prepend to a draft, and a script to run a Drafts action.

Maybe they’ll be useful, maybe they won’t, but now I’ve got a few more scripts waiting for me should I find a particular need for them in the future.

1 Like

Ok. Thanks. Much obliged.

Thank you so much,@sylumer, this is gold.

The nice thing about Drafts, especially the current developmental stage, is that it is so versatile that there are hardly any things that cant’t be done. That said it would be nice if Drafts was shipped with some ’authorized’ versions of what I or others have created with third party solutions. (I would be happy to share my own work for free but it is somewhat unpolished and cannot compete with built-in facilities.)

Here are some small wishes based on my own recent work.

  • Improved Preview for printed media.
    • Previously I hade some problems with footnotes to internal elements (but haven’t checked if that has been fixed now).
    • I have even set up some templates for some longer reports, and have actually skipped both Word, Pages, Scrivener, but am now looking into Paged.js to see if that will take me even further—with Markdown only.
  • Improved stability (may have been fixed now but Drafts usually crashed after automized creation of drafts from Alfred hotkey when clicking on the UI).
  • Global shortcuts for Drafts’ Capture
—with or without OS selection or clipboard—even if Drafts isn’t running (those rare occasions) and with a customizable (or minimalistic) capture window.
  • CLI (Command Line Interface is here already or easy to build but would just be nice to have shipped with Drafts own ecosystem).

Here are some more details and motivations for the shortcuts (some of which has been mentioned elsewhere).

Yesterday I updated my Alfred workflows for quick and easy capturing of ‘stuff’


(inspired by GTD Getting Things Done¼ - David Allen’s GTD¼ Methodology.

Because it is crucial to have the most frictionless, fastest and easiest method possible Drafts has become one of my major capture tools. I also like the capture window because you can easily decide what you want to do with your text later. Further, one key is simpler than a combination of many, keys on the the side of the keyboard are easier to find than in the interior, double tap is usually faster and safer than tapping more keys in succession, why I decided on the following options.

  • ⇧ double tap is my hotkey for Draft’s Capture
 and also captures any OS selection.
  • ⌄ double tap is similar to above but pastes the current clipboard.
  • ⌘ double tap, also similar, but captures a draft with pre-filled data for those occasions when you have to take structured notes on the fly (e.g. from a phone call or other interruption) that you may have to later share with one ore more participants. (This may also be accomplished with a Drafts template but I already had some snippets since way back in time.)
    • EVENT (a time and place, complemented with some contextual information)
      • When: Saturday 2021-01-03 18.25.09 (Customized time stamp, mostly the same as Draft’s metadata but not necessarily so, and also nice to have in the same note if shared.)
      • Where: [Place](maps:?ll=65.091857910156,17.114915801267&q=Place) (Already in the draft metadata but nice to have included in the note itself, customizable and for sharing. BTW Welcome to this place if you are passing by.)
      • How: The kind of ‘trigger’ for the event, prefilled with Phone because it is usually a lack of time then.)
      • Who: I (and rest of participants in clockwise order if around a table or similar.)
      • Why: The reason or purpose for the call or meeting.
      • What: Points discussed in the meeting to varying degree of detail, sometimes even including actions to be taken where you can later easily find all incompleted tasks with Drafts excellent search capabilities.
    • Next actions
      • [ ] Who should have done what by when? A list of tasks if not already included above. (These may also be sent to OmniFocus, Due, Calendar event or a cron job depending on the type of task and urgency.)
1 Like

Authorised would suggest officially supported, which doesn’t sound like it would be fair to Greg in terms of providing that support. Support from creators in the community I think is generally accepted to be on a best endeavours basis.

There are plenty of examples of this sort of approach throughout computing, many of which on Apple’s platforms

For what it’s worth, there are “Trusted Member” and “Tested Action” badges on the action directory, which I think goes at least some way towards providing what you are suggesting.

3 Likes

Thanks for the tip about badges.

I agree completely Greg could not and should not support every wanted add-on to Drafts. There is even no need for that with such a capable ecosystem and active developers. This was just some answers to the question: “What services would you like to see added to Drafts?”

Since the Mac version of Drafts has crashed on a continuous basis for about a year when triggered by hotkeys and trying to use the UI to then open the created draft, this seemed to me like a problem for Drafts to handle and better to include in the application (if simply not satisfied with “Well, don’t DO that!”). That was also part of the reason I had to build an interception tool to see if Drafts was running and otherwise launch it (again) to activate the hotkeys. Not a big problem at all but a little annoying that such a great application crashes every time this happens for some cumbersome reason.

Also, non-standard behavior in Markdown is hard to do something about if not resorting to work-arounds and manual editing of the produced html (then turning to Safari, Chrome, Marked or whatever). Internal links lead to generated URLs like file:///Applications/Drafts.app/Contents/Resources/#H1 which takes you nowhere in an exported pdf.) Maybe that’s an even bigger issue than a pure Drafts problem but nice if there was a simple fix for that “for whom it may concern”.

Did you raise that issue through the support channel? I think we would have heard more about it if it were a common one.

Link content is something that you are in charge of. It sounds like you are using internal crosslinks. If you need an externally valid link, then I would suggest that you include an externally valid link in the content. Markdown to HTML conversions do just that, but you could of course do the conversion. an action, then apply a script to modify the HTML (or the initial Markdown) before previewing r handing off for PDF generation. For example, you could have an action triggered by URL that receives text that enables the action to load the required draft and jump to the defined heading.

Disclaimer: This may not be the right forum to discuss stability or performance issues of Drafts but it was a consequence of services I would “like see added to Drafts” and built my own in the meantime. Feel free to move this discussion elsewhere.

Crashing problem probably solved

Since I use to push both hardware and software to the limits it is not unusual I experience problems few others have noticed and that may even be worked around. (E.g. “800k characters is too large for the macOS NSTask in the Run Script object in the workflow, which is why you’re seeing the posix error” which is a totally different story concerning Alfred, but things that may happen if you don’t have access to full documentation or a forum.) It may also be the case that such errors disappear in later versions or products due to improved code or more stable hardware.

The problem with Drafts crashing seem to have occurred when

  • Triggering a workflow with an Alfred ⌘ dubbel tap that sent a URL-encoded string to
  • drafts://x-callback-url/create?text=An%20URL-encoded%20string%20in%20Markdown%20format%20of%20about%20350%20characters.

Draft was created perfectly all right, but clicking the Draft list made Drafts crash.

However, since then I switched to other methods, letting Drafts itself receive keystrokes from AppleScript “System Events” and creating the desired draft window for me with dynamic content, which works beautifully. The most reassuring fact though is: I tried to recreate the old solution but was not able to reproduce this problem in Drafts 25.0.12 under macOS Big Sur 11.1!

So, as far as I’m concerned this Happy New Year: Problem solved—but I still would like to see a global hotkey for quick capture of OS selection and clipboard service added to Drafts (that also makes sure Drafts is running).

Markdown footnotes

External links work flawlessly but not internal ones in Preview or when saved as pdf.

E.g. if I create i footnote in Markdown the link in preview is

~/Library/Mobile%20Documents/iCloud~com~agiletortoise~Drafts5/Documents/Library/Previews#fn:12715

and not simply #fn:12715 which it is if you copy the HTML and then create a pdf. Wouldn’t it be nice if that worked directly in preview (without any HTML + sed, awk etc. after the preview)?

Not sure what you are seeing with Footnotes. If you are using MultiMarkdown, the footnotes are generated as #fn:... links in the HTML.

When displayed in a Preview, if you are just using contextual menu’s to “Copy Link”, you would get the file URL because that is behavior of the web view which has a base URL in context. That is not in the HTML generated and should not affect your export workflows. If you use the “Copy HTML” option in the Preview, you will see that those paths are not in the generated links.

Ah, thank you, it may explain part of the problem. (I don’t want to cause you problems that may be trivial but if you have the time
)

Why do the links then don’t work in either preview or the exported pdf—but in a generated pdf from the copied HTML, opened in a browser?

(When clicking internal links in preview, nothing happens and not in the saved pdf. Could it be a language or locale issue even though I tested with documents written in English?)

After some struggle I was able to export my draft (fn.txt) to a pdf with pandoc:

pandoc -f markdown -o test.pdf fn.txt

This yields a paged pdf with a working footnote on the same page as the (clickable) link but no return link, which is not necessary, given it’s the same page. I haven’t looked into the settings of pdflatex but recognizes the TeX style, which may not be a bad thing for those kind of documents.

However, that’s no easier than simply copying the HTML (which works perfect), and use a browser or other pdf rendering program.

I feel almost ludicrous begging for a professional typesetting studio from a “simple text first” approach but combining Drafts with TeX, s.a.

$$\int\limits_{0}^{\infty}\frac{x^3}{e^x-1}dx = \frac{\pi^4}{15}$$

and rendering a preview with some well crafted templates goes way beyond my wildest expectations when I first started to use Drafts on my iPhone some years ago.

Extremely well done! Must be one of the best and most versatile software products ever.

It’s been 2 years and no Ghost integration. I’d still love to see this.

ClickUp: robust and easy to use ClickUp integration please. Anything that is working well to Omnifocus would be great ported to ClickUp. I’d like to ba able to add actions for ClickUp.

Notion: send pages and cross-links into Notion, publish Drafts to new pages, publish snippets to existing pages.

Translation (Google or Apple): enable Actions to translate drafts and snippets to other languages and save/copy the result.

1 Like

I would still like to see Drafts on the Windows 10 platform similar to what has been done for MACs. I use Apple iPads, iPhones, and watches. However, work necessitates the use of Windows PCs. Drafts on Windows would be very helpful as TextExpander on Windows has been.

Keep in mind that Drafts is built at a fundamental level on Apple technology, so to allow it to run on Windows, either Apple would need to port some of their infrastructure to Windows, or Drafts itself would need to be rewritten to be independent of the Apple infrastructure on which it relies 
 and that would require the creation and maintenance of such an infrastructure unless a compatible cross-platform one could be identified.

Smile (the software house for TextExpander) for example built their own sync infrastructure and it wasn’t until that was in place that they launched the first Windows beta. They also have a different pricing model, multiple products and a team of people they employ.

AgileTortoise on the other hand is Greg, and Drafts I think is his only currently active product; though there have been others in the past and the odd beta for other things may be discovered in the beta Slack.

I think there is maybe a way to have a lightweight web version of Drafts that could tap into some of the sync. I’m hoping that may be a Windows solution one day; I’m a Windows user by day. But again that probably requires an infrastructure investment from AgileTortoise, probably couldn’t have the same feature set as it does on a mobile or desktop OS, and would not be a trivial project for Greg to undertake. But, maybe one day, it or something equivalent might appear on his road map.

2 Likes

sylumer; Thank you for your reply and comments. Greg is rather superhuman when it comes to developing features for and supporting Drafts and I tend to think that there is nothing that he cannot accomplish. I appreciate your putting the obstacles to porting Drafts to the Windows PC into perspective. Drafts is such a valuable part of my workflows, that I would certainly like to have it on my primary work tool, the Windows PC. In the meantime, I will cobble together a solution with Typora, Obsidian, and Drafts across my various devices and hope for a miracle.

I would like to take the opportunity to thank you, sylumer for your contributions to the Drafts ecosystem. Your Drafts Action Groups have been very helpful. Also thank you for your contributions to the Public Groups for TextExpander. I particularly like your JavaScript work in the Past and Future Dates Public Group. I have learned a great deal from editing some of those snippets for my specific uses.