Convert a List to OPML for Fargo with Drafts

I’ve been using Dave Winer’s new outliner product Fargo frequently, yet I often initially enter my ideas into Drafts for iOS. Fargo works with OPML files, but if you copy a list into it (even one with tab indents), Fargo will maintain the structure, creating a new node (or “headline”) for each line and even making the tab-intended lines “children” of the main line above them.

The Problem: how to get my list in Drafts into Fargo with the least amount of effort?

It’s possible to just send the entire list to a text file in Dropbox, then access that file on the desktop, copy it, and paste it into Fargo. But there’s a better way. Inspired by Alex Guyot’s work on chopping a draft, I’ve composed a five (!) Drafts actions that let me convert a text list of any length into an OPML file that I can import into Fargo. The key to this solution is an URL Action that works as an infinite loop, in which the following occurs:

  • Take first line of draft ([[title]]) and use it to create the opening of the OPML file.
  • Take the rest of the list ([[body]]) and create a new draft with it.
  • Take the first line of the new draft and append it as an outline node to the OPML file I just created.
  • Take the rest of the list ([[body]]) and create a new draft with it.
  • Repeat those previous two steps ad infinitum until the loop is closed, i.e., we’re left with an empty draft.
  • Then close the OPML file with the final line from the list and the closing tags.

[Read more...]

Log Actions With Just Two Taps on Your iPhone

Allergy season has just started for me, and I’ve resumed taking Claritin. I don’t have the best memory, so I am logging the date and time each instance in which I take a pill. Fortunately, with the help of four apps 1 I can literally just tap twice on my iPhone to add the time to a text file. This solution does take a few minutes to set up, but afterwards you won’t even have to open up the keyboard. This can work for any activity in which you need to log your time — not just for taking meds.

Requirements:

In this tutorial you will set up Launch Center Pro (henceforth LCP) with a Custom URL that expands a TextExpander snippet to Drafts, triggering a Dropbox (or Evernote) action to prepend a date/time configuration to a specific file or note. After setup, you will be able to open LCP, tap on an action, and immediately have text like “04/29/2013 1:06pm” added to the top of a note titled something like “TookLoratadine” (Loratadine being the generic version of Claritin). Much of the following is customizable: the date/time format, your cloud service, and the name of the file.

Step 1: Create a TextExpander Snippet

TextExpander (TE) is a service that enables you to type out a short snippet that expands automatically into a longer sequence of text — provided you are using an iOS app that supports TE. TE supports date/time snippets that allow you to customize how a date/time is written out. View their reference page. If I create a snippet called Tdate whose content is %Y-%m-%d %1I:%M %p and type out Tdate in a TE-supported app, it will expand into 2013-04-29 1:20 PM. If instead I want the date formatted like 4/29/13, I can make the content %1M/%e/%y. To set this up in TE, go to Groups, select or create a group, enter the snippet in the Abbreviation field and the date math in the Content field.

Step 2: Create a Dropbox or Evernote Action in Drafts

Drafts has long supported Dropbox actions in which you can create a note or prepend or append text to a note. Since its 3.0 update, Drafts also support Evernote actions in which you can do the same. For the purposes of this example I am using a Dropbox action in which I prepend to a note.

Dropbox action

I’ve named this action “prepend Trunk Note” because I am entering this note into my personal wiki. (Learn more about Trunk Notes.) The Dropbox path for notes in this app is /trunksync/notes/. (If you use nvAlt, just use its Dropbox path.) For the filename I have chose predefined and I am titling it [[title]] which is drawn from the first line of the entry in Drafts. For extension I have entered markdown but you can also enter txt for a regular text file. For Write, I have chosen prepend so that newer dates show up at the beginning of the note. And in the template I have entered [[body]] which is drawn from any text after the first line in Drafts. If you’re on your iPhone right now, tap on this link to import the Dropbox action into your version of Drafts. You can then edit the action as you like.

When you create an append or prepend action, Drafts creates the file the first time you run it, and thereafter it adds text to it. In my Dropbox action above, as long as the first line of my draft is always the same, whatever is in the rest of the draft will just be added to that note. In the next step, I will be creating an URL in LCP in which the first line of the draft is always TookLoratadine. That will become the title of the note in which I will be prepending the date and time that I take my next dose.

Step 3: Create a Custom URL in Launch Center Pro

Launch LCP. Go to Action Composer and create a Custom URL.

drafts://x-callback-url/create?text=TookLoratadine%0A<Tdate>&action=prepend%20Trunk%20Note

 

Custom URL in LCP

I’ve titled mine Loratadine. This action does the following:

  1. Adds the text TookLoratadine to the first line of a draft in Drafts.
  2. Using an URL-encoded line break (%0A), it expands the TE snippet Tdate (which must be within the < > brackets) and puts the date/time on the next line.
  3. It then tells Drafts to perform the action prepend Trunk Note. It includes URL-encoded spaces (%20) between each word in the action.

If you want to customize this Custom URL, enter the following into LCP and swap in the FIRSTLINE, SNIPPET and DROPBOXACTION.

drafts://x-callback-url/create?text=FIRSTLINE%0A<SNIPPET>&action=DROPBOXACTION

 
Everything else should stay the same if you want this to work. Just make sure that the action is the URL-encoded title of the Dropbox or Evernote action that you have created.

You’re All Done

Next time you need to log the time and date you’ve completed a repeating task, just open LCP, tap on your action, and you’re done.

When I do it, something like the following will shortly show up in Drafts before the action is performed. (I set this Dropbox action to delete the draft after it is completed).

Took Loratadine
2013-04-29 1:20 PM 

 
If I want to view my log, I can either open Trunk Notes and open the TookLoratadine note, or use an URL scheme for a Dropbox text editor, like Nebulous Notes:

nebulous://trunksync/notes/TookLoratadine.markdown

 
Hint: if you enter this as an URL action in LCP, then you can also do two taps to view your log.


  1. See the comments for a solution that removes the need for TextExpander. 

Add Title, URL, and Description to Pinbook with This iOS Bookmarklet

To piggyback on yesterday’s post about the incorporation of the iOS clipboard contents in Drafts 3.0, I’ve written another bookmarklet/URL Action combo. This one lets you add the title, URL and selected text from a web page to Pinboard via the Pinbook app. (I’ve written a previous post about URL Actions for three different Pinboard apps but I’ve stuck with Pinbook. You can adapt my workflow below for different apps if their URL schemes support the same parameters.)

I’ve adapted Federico Viticci‘s javascript bookmarklet to put the title on the first line in Drafts and the URL in the second line to create this workflow. First, while on your iPhone tap on this link to import the URL Action into your version of Drafts. (Make sure you’ve upgraded to the latest version.) Or you can create an URL Action, title it “pinbook-desc” and enter the following:

pinbook:///add?title=[[title]]&url=[[body]]&description=[[clipboard]]

 
This action takes the first line of the draft and makes it the title of your bookmark. The second line becomes the URL, and the contents of the clipboard becomes the description of your bookmark.

Next, you need to create a bookmarklet in your iOS browser. In Safari, bookmark any page and change the title to “Pinbook-Desc” (actually you can call it whatever you want). Then open bookmarks, tap on Edit, then open “Pinbook-Desc.” Tap on the URL, and then tap on the X to delete it. Then paste the following into that field and save the updated bookmark.

 
update bookmark

Now you’re all set. If you want to save some text in your Pinboard bookmark, select it and then tap on copy. Then open bookmarks, tap on “Pinbook-Desc” and the bookmark will be auto-filled with the page’s title, URL and your selected text.

select text

pinbook

Addendum (2013-04-26)

You don’t need Drafts to add a description if you’re on an iPad. The document.getSelection javacript will work on an iPad if the bookmarklet is in your Bookmarks Bar. You can grab that bookmarket here.

Add Clipboard Contents and URL to Quotebook with Drafts 3.0

Drafts 3.0 just came out. It has many new features, but one notable addition is that it now uses the clipboard contents. I was trying to think of a cool way to utilize this function, and came up with a bookmarklet that lets you add the clipboard contents of a page and its URL to Quotebook. Quotebook autodetects the clipboard contents, but if you want to remember where you found a quote, you still need to go back to the browser to grab the URL.

To make this work, you both have to add an URL Action to Drafts and install a javascript bookmarklet on your iPhone. If you’re on your iPhone when you read this, tap on this link to import the action into your version of Drafts. (Make sure you’ve upgraded your version so that it supports the clipboard function!) This action is called “quote” and the template is as follows:

quotebook://add?quote=[[clipboard]]&source=[[draft]]

 
Here’s the Quotebook URL scheme.

Next, create the bookmarklet. Bookmark any page and call it “Quote.” Then tap on the bookmarks icon, tap on Edit, and then tap on the URL. Tap on the X to delete it, and paste in the following:

javascript:window.location='drafts://x-callback-url/create?text='+encodeURIComponent(location.href)+'&action=quote'

 
Save the new link, and you’re all set. Now go to any page in your mobile browser. Select some text and tap on Copy. Then open your bookmarks and tap on Quote. After a short stop via Drafts, you’ll end up in Quotebook with both the quote and the URL already entered.

copy quote

quotebook

iOS Bookmarklet to Convert Link into OPML File for Fargo.io

I’ve been using Dave Winer’s new outliner Fargo obsessively since its launch. It has lots of useful keyboard shortcuts, and imports/exports all outlines in OPML format. You may be familiar with OPML as a way to store a list of RSS feeds, but it’s also used by mind-mapping applications like iThoughts and MindNode, as well as outliners like Carbonfin Outliner.

Unfortunately, this application is very much desktop-focused. It barely works on the iPad. Fortunately, Fargo syncs with the /Apps/smallPicture folder in Dropbox, so if you can get an OPML file into this folder, you can import it once you’re back on the desktop.

I’ve been using Cotton Notes on my iPhone and iPad to work with outlines, because I can tap on any node and export that node and all its subnodes as an OPML file to the /Apps/Cotton Notes folder in Dropbox. This app also will import OPML files. When you import an OPML file that includes links formatted as follows

<outline text="Google" type="link" url="http://google.com" />

 
it converts it to Markdown:

[Google](http://google.com)

 
One the one hand, this is great, because it still keeps the link and you can toggle between previewing the Markdown or not. The downside is that when you export the outline, it stays in Markdown.

In Fargo, the first link format (which is according to the original spec) displays with this icon bookmark instead of a wedge, and when you use the expand shortcut, Fargo opens the link in a new tab. Fargo does not support markdown, so if I import an OPML file from Cotton Notes, the link will show as [Google](http://google.com).

Fargo does let you create an HTML link within the text, but if you export it, the HTML is URL-encoded. For example, an HTML link in Fargo (which looks like Google) will export as follows:

&lt;a href=&quot;http://google.com&quot;&gt;Google&lt;/a&gt;

 
This is unreadable if I import it into Cotton Notes.

I suppose the proper way to create a link in Fargo is to choose Edit Attributes… in the Outliner menu, and manually add them:

type link
url http://google.com

 
This creates a link according to the OPML spec and will properly import into apps like Cotton Notes and iThoughts (although these apps then change the link formatting).

The OPML Bookmarklet

All this to introduce a bookmarklet I’ve written for iOS. It will take the title and link of a page and create an OPML file in the /Apps/smallPicture folder, which you can then import into Fargo. (To import, just go to File > Open and then click on a file called “Link” with a filename that is a timestamp. This will create a new outline in Fargo.)

This bookmarklet requires Drafts. From your iOS device, you will need to tap on this link to import a Dropbox action into Drafts called opml.

Then, bookmark any page in mobile Safari and title it opml. Tap on bookmarks and edit, and remove the URL of the bookmark. Paste in the following and then save:

 
You’re all set. Next time you want to import a bookmark into Fargo, just tap on the opml bookmarklet. It will send a formatted link to Drafts, which will then insert the draft into an OPML file, which is then saved to Dropbox.

If you want to get the link into an outline in which you are already working, create a public link for the new outline, copy the URL, go to your working outline, click on Import… and enter the public URL to import the link into that outline.

Warning

If a title or URL that you’re bookmarking contains any special characters that would ordinarily have to be encoded, this bookmarklet will not work. It will create an OPML file but if you try to import it into Fargo, it will show up null. (For example, & needs to be &amp;.) I don’t know any way around this. You’ll have to actually go into the OPML file to fix the URL or just bookmark URLs that don’t have parameters.

Send a Task from Drafts to Trello with the Help of Zapier

Although I’ve been getting geeky with text-based todo lists (like TaskPaper), the rest of my family does not share my passion. Fortunately, I finally found a collaborative task-based system that both my wife and I like: Trello. This is a visual tool which appears to be inspired by Kanban boards. Basically, you have boards which contain lists, and each list contains cards. And each card can be labelled or have checklists or attached docs or assigned members, and so on. It’s easy to drag cards around, and the dragging effect on iOS devices is kinda fun.

Granted, this web app is far from text-file-friendly, but there is a way to, say, jot something down in one of my favorite apps — Drafts — and get it into Trello. And that’s with the help of Zapier. Zapier is like IFTTT on steroids, or at least an IFTTT for business. It’s a freemium product, and for free you get 5 “zaps” (like IFTTT recipes) and 150 performed tasks. Because Trello has an API, Zapier can combine it with email.

I’ve created a shared zap that allows me to send an email to a secret address. The subject line of the email become the title of a card in the “Inbox” list of the “House” board in my Trello account. Because Drafts supports background email actions, it can send your draft to your secret Zapier address from drafts-mail@agiletortoise.com.

If you’re reading this on your iOS device, tap on this import action to add the Email Action. Then edit it to replace SECRETEMAILADDRESS with your secret Zapier address.

After you’ve set all this up, just create a draft, tap on the House Trello action, and your task should be immediately added to the board and list of your choice, where your family members can view it.

Schedule a Tweet for Later with Due and Drafts

There are many apps that let you schedule your tweets, but if you have Drafts and Due on your iPhone (plus Tweetbot or the native Twitter app), that’s all you need.

The following is adapted from Nathan Henrie who wrote a Drafts URL Action to send a time-delayed text message. Please read his post first if you want to understand the logic (but you don’t have to “get it” to have the action work).

In my “Tweet Later” URL Action, you enter the day and/or time in natural language on the first line of Drafts, and then enter your tweet on the second line (and thereafter). Hit the “Tweet Later” action, and you will be sent to the Due app, where you tap twice at the top of the screen to parse the time and then remove the language from the title. (If you were to enter “Buy eggs at 4pm” in Due, tap the top twice to automatically set the alert for 4pm and reduce the title to “Buy eggs.”) You will then be prompted to return to Drafts.

When the alarm goes off, tap on the checkbox and it will prompt you to open the URL. Tap on it, and Tweetbot will open with the text of your tweet.

Here is the URL Action:

and if you are on your iPhone you can tap here to import the action into your version of Drafts.

Make sure to substitute SCREENNAME with your Twitter handle.

Prefer the Native Twitter App?

Alternatively, you can use Drafts’ native Twitter actions:

If you are on your iPhone, tap here to import the URL Action.

Once again you will have to sub in your username. Please be aware that this action automatically posts your tweet in the background.

Bookmarklet to Save a Link and Title in Markdown Format and Copy to Clipboard

Inspired by Federico Viticci over at MacStories, I have created a bookmarklet that allows you to grab the title and URL of a web page in your mobile browser, have it formatted in Markdown as a link, and then copied to the clipboard so that you can paste it into the iOS text editor of your choice:

 
This bookmarklet relies on the Drafts URL scheme (which means you have to have it installed on your device). The page title is surrounded by URL-encoded brackets, and the link is surrounded by parentheses, as follows:

[MacStories](http://www.macstories.net]

 
This text string is then copied to the clipboard using the action parameter. (Visit Drafts for Developers to learn more.) “Copy to Clipboard” is a built-in action, so you don’t have to fiddle with Drafts to make this bookmarklet work.

Bonus!

If you would like to immediately jump to your iOS text editor of choice (provided it has an URL scheme of its own), you can add something like the following immediately before the final single quote in the bookmarklet:

&x-success=byword:

 
By adding the above to the bookmarklet, Drafts will automatically open Byword after it has copied the link to the clipboard. If you use a different app than Byword, just insert its link after the = sign.

How to Create a Bookmarklet

If you have never created a bookmarklet before, do the following:

  1. Copy the above script to your iOS clipboard.
  2. In mobile Safari, bookmark any page, and call it something like “Markdown Link.”
  3. Then go to bookmarks, tap on Edit, then tap on the bookmark.
  4. Tap on the URL of the page you actually bookmarked, then tap on the X to delete it.
  5. Paste the script into that field and hit Done.

Use a Recursive URL Action in Drafts for iOS to Create a Public Note in Dropbox and Tweet a Link to That Note

The x-callback-url spec allows apps to communicate with each other, and takes URL schemes to another level. My first exposure to URL schemes was via Launch Center Pro, which enables you to to, for example, enter prompts within the app and then send this text to Omnifocus to automatically create a new task with a note.

omnifocus:///add?name=[prompt]&note=[prompt]

 
The callback lets you take yet another action, like return to an app (more possibilities below). In a previous post, I outline how I composed the following to send the contents of the clipboard from LCP to Drafts to Dropbox and then return to LCP:

drafts://x-callback-url/create?text=[clipboard]&action=Save%20to%20Dropbox&x-success=launchpro%3A

 
To summarize: I entered this URL in the Action Composer in Launch Center Pro. When I tap on the action, it takes the contents of the clipboard and sends it to Drafts. It then performs the action Save to Dropbox and after that has been successfully completed, it returns me to Launch Center Pro.

[Read more...]

Add a Task to TaskPaper with Drafts Using Dropbox Actions

TaskPaper has long been my todo-list iPhone app of choice, because it stores its data in a simple text file, not an XML file or some proprietary format. Oh, and the text file syncs with Dropbox, so I can edit my todo list in any iOS Dropbox-friendly text editor, or on my Mac. However, instant capture is not TaskPaper’s strong suit. It does not have an URL scheme that allows you, say, to enter some text in Launch Center Pro and have it added as a todo in TaskPaper. I have in the past come up with various hacks, from using Launch Center Pro to prepend a task to a text file in Nebulous Notes, which I sync with my TaskPaper Dropbox folder to using Drafts to send an email to IFTTT to add a task to my TaskPaper file in Dropbox.

Now that Drafts — a note “capture” app that lets you send your text to various iOS apps and web services — supports Dropbox Actions, I can finally send a task straight to my todo list from Drafts.

[Read more...]