The Byword Action Group

Yesterday, Byword was updated to introduce a pretty powerful URL scheme. Notably, the scheme supports x-callback-url. If you're a user of both Byword and Drafts, this could be great news for you and your workflow.

The Byword URL scheme supports five main functions: New, Replace, Append, Prepend and Open. This creates a wide variety of possible functions for many different occasions. Here I will mostly be focusing on possible integrations between Byword and Drafts, but here's one quick and very simple possibility for integrating with Launch Center Pro: if you're a Byword user on your iOS devices and your Mac (or just iOS devices), you could very easily create a Launch Center Pro action that lets you open a particular file that you add to or are working on frequently with a single tap. If you have a large file that you update often, and ever want to make a quick change to it on your iPhone, now you can make that change even quicker with this simple Open action. If you have multiple of these files, create a folder with multiple actions. If you have far too many, you could even make the action prompt you for a title first, and typing in the title will open the corresponding file in Byword. (That last one, however, may not be faster than simply opening the app and accessing the file there.) If you have any specific use cases identical to, or similar to those I mentioned above, and need help with any of those simple and quick actions, contact me and I'll write them up for you.

So on to Byword and Drafts. The interesting thing that Byword has done with this powerful scheme is that they have basically created a level of possible integration with the same amount of power as the custom actions services already integrated with Drafts: Dropbox and Evernote. Using templates for the built in Dropbox and Evernote services allow for the same types of actions: Creating a file, appending to a file or prepending to a file. Byword has even added a fourth: completely replacing the contents of a file. This means that you now have a third choice if you wish to perform similar functions, you can store your files in Byword's iCloud or Dropbox services, yet still append, prepend, create and replace the text within them. So if you prefer to write on Drafts on your iPad or iPhone, but use Byword on your Mac since there is no Drafts for Mac, you now have a way to sync the work you've done on your iPad or iPhone with the work you've done on your Mac.

The Action Groups --

Following the links below on an iOS device with Drafts installed will open a new draft formatted correctly to run my Batch Import Action and import all the included actions at once. Before importing you can check each action to make sure it is how you want it to be, tweak them if you need to (such as changing the "icloud" presets in the actions to "dropbox" if you store your Byword files in Dropbox or "local" if you store them locally on your device), and delete any that you don't wish to import. Just make sure you have the four actions necessary for batch importing already installed on your device in Drafts (follow the link at the start of this paragraph to get them).

The Byword Action Group

Click the link above to open a Draft formatted to batch import five Byword actions:

  • An action to open a file in Byword (No callback here, it wouldn't really make sense)

  • An action to append text to a file in Byword, then immediately return to Drafts

  • An action to prepend text to a file in Byword, then immediately return to Drafts

  • An action to replace the text in a file in Byword, then immediately return to Drafts

  • An action to create a new file in Byword, including the text of the file, then immediately return to Drafts

The Format -- In order for the above actions to work properly, you must run them on a draft formatted as so: the first line of the draft is the title of the file that you wish to open, append to, prepend to, replace text within, or create. This title must include the extension for the file (i.e., ".txt", ".md", etc.). The body of the draft (everything after the first line) is the text which is appended, prepended, used in replacement of the previous text in the file, or used as the text for the new file, depending on which action you call on your draft. The "Open Byword File" action does not necessitate text in the body.

Possible Tweaks -- If you wish to create an action that effects one particular file every time without you having to specify, similar to the built in Evernote or Dropbox templates, you can do so easily by opening the raw actions through the link above and changing "[[title]]" in each action to the actual title of the file you wish to manipulate. Then also make sure to change "[[body]]" in each action to "[[draft]]", so that Drafts knows you are now using the entirety of the draft, not just everything but the first line, for your document.

**Important: Don't forget that if you replace [[title]] with the actual title of one of your documents, you must wrap the title of the document in {{curly brackets}}, so that Drafts knows to encode it, or else the action will fail. (You could also, optionally, percent-encode the title yourself, but the brackets are easier.)

Also, if you actually do not wish to be returned to Drafts after you have successfully appended, prepended, created or replaced, you can remove "x-success=drafts://" from any of the actions to disable that functionality.