Advanced Tips for Drafts App

Often advanced features in my favorite apps are tough to explain because they are so open to customization. Examples usually help. Here are some handy Drafts tips I’ve either discovered or created that might give you some idea on how to take advantage of Dropbox actions, URL Actions, and email actions.

– Use date stamps to create a scratchpad text dump file

– Log your tweets

– Log your Google searches

– Log everything!

– Use IFTTT and email action to subscribe in Google Reader

– Use date stamps for an auto-created monthly journal text file

– Use bookmarklets to log webpages or send to Reminders

 

Use Date Stamps To Create A Scratchpad Text Dump File

The new date stamp functionality is great. It allows you to have a date/time string inserted into your draft text in the format you prefer, and using the template you can insert it as you like in the draft. For example, the following screenshot shows how I’ve set up a Dropbox Action to append a specific text file on Dropbox with my draft text.

The set up appends the draft text to a specific text file on Dropbox (Scratchpad.txt). The content that is appended is the text in the draft, as well as a date and time stamp that is automatically prepended to the draft text, using the template:

[[date|%Y-%m-%d %-I:%M %p]]: [[draft]]

This will output the following:

2013-03-02 1:16 PM: My draft text content

This allows you to quickly send snippets of text to a dump file right from Drafts, and the date/time stamp gives a bit of order to the whole thing. You can learn more about structuring date/time stamps using the strftime formatting from Dr. Drang. (Update 3/10/13: I’ve updated the code here for the time formatting, I had it wrong when first published)

Log Your Tweets

You can also chain together two actions so you can log each Tweet you send from Drafts. Here’s an example. First, you’ll need to create. Dropbox Action to append text to a text file. In this case the file is named “Tweet log” and the name of the action is “Append to Tweet log”:

Next, you set up a URL action that first creates a new draft with the text from the current draft, and then performs the “Append to Tweet log” action, which then again creates a new draft and uses the built-in Tweet option to send the tweet:

drafts://x-callback-url/create?text=[[draft]]&action={{Append to Tweet log}}&x-success={{drafts://x-callback-url/create?text=[[draft]]&action=Tweet%3A%20TWITTER_USERNAME}}

Basically we are creating a meta-Action that invokes two other Actions (“Append to Tweet log” and “Tweet”). This meta-Action actually creates new drafts entries with the text, and then performs each action in turn. And you can even hide these “background Actions” from the main list, and Drafts will still let you use them in URL Actions. Great for keeping your Actions list a bit less cluttered with these “background Actions”. You’ll find it handy to set some or all of these to auto-delete after they are invoked to avoid flooding your Drafts list with all the duplicates. You can do this on a per-Action basis in the Manage Actions section in the Settings.

Log Your Google Searches

Again, the above examples can be tweaked to search Google and log that search query to a file by chaining URL Actions as described above. You can install a pre-made Google search action by visiting the official Drafts Actions Directory on your iOS device. Just swap out the Tweet action for the Google action title (and make sure it’s URL encoded, which basically means converting spaces to %20 in most cases).

Log Everything!

Take the URL Action chaining even further and log anything you do in Drafts using the two above examples. Just swap out the second action with any Drafts action to log it then perform that action. A nice way to keep an activity journal of notes, ideas, thoughts, tweets, searches and more.

Use Date Stamps For An Auto-Created Monthly Journal Text File

Not only can you use the strftime formatting to insert the current date and/or time to the body text, you can use it to name a file. This is super handy to keep a monthly journal text file. By telling Drafts to create a file using the proper strftime format, you can create files with names or numbers for the current month automatically as we enter a new month.

Obviously this could be tweaked for a daily file, or a yearly file as well.

The above image would create a text file named “monthly-2013-03” if one didn’t already exist. This can be taken even further to name folders as well. And Drafts or Dropbox is smart enough to use an existing folder or file if it matches, instead of creating duplicates.

Use Bookmarklets To Log Webpages Or Send To Reminders

This one is a bit more tricky, and since I’m no JavaScript expert I’ve resorted to reverse engineering the examples provided by Frederico Vittici over at MacStories for these. In short, you can set up bookmarklets in JavaScript for your iPhone or iPad that use the drafts:// URL scheme. The JavaScript grabs the webpage title and URL, and then sends to Drafts. If you want to get really geeky on this, you can send the captured text to specific actions in Drafts, and automate things like sending a webpage and URL to the iOS Reminders app, and then returning you to Safari. Here’s an example of that code:

javascript:window.location='drafts://x-callback-url/create?text='+encodeURIComponent(document.title+'%5Cn')+encodeURIComponent(location.href)+'&action=Reminder&x-success='+encodeURIComponent(location.href)

For reference, the '%5Cn' is a line return. That way when a reminder is created, you can have the URL added in the notes field of the Reminder (now that this has been fixed in Drafts) if you’ve enabled “Use first line as title” in the advanced preferences for the Reminders action. This can be tweaked to send time stamped webpage titles and URLs to a Scratchpad.txt file instead of a reminder. Vittici offers a bunch more for things like sending text to Evernote. And you can use my tips above for logging stuff to save to Reminders and then log to a text file as well.

Use IFTTT And Email Actions To Subscribe In Google Reader

The excellent automation service IFTTT has a feature where you can email a URL to the service, and it will subscribe to the RSS feed for that website in Google Reader. Here’s a link to my IFTTT recipe that performs this. Using the Email Actions in Drafts, you can take advantage of the template feature to set up an action that automatically appends the hashtag to the subject line, which I’ve required in the IFTTT recipe (to avoid inadvertent subscribing).

Note that “Send in background” is off, because IFTTT requires trigger emails to come from your account address. Of course you could set up a separate IFTTT account just for Drafts as a workaround. Also note that I have chosen the option to use “First line” for the subject of the email. You can also add custom text to be appended, which is where I’ve added the #greader hashtag.

Note that this can be employed for send stuff to Evernote and specifying specific notebooks and adding tags, as Evernote uses a similar functionality for the subject line. Your next project is then to create a bookmarklet Action which grabs the URL, sends it to Drafts, and preps that IFTTT email for you by invoking this action. I’ll leave that one for you to work out, it’ll be good practice.

Wrapup

I’ve got way more Actions in Drafts than I’ve mentioned here (too many I think), and have played around with some of the more complex examples provided by Vittici, but I’ve since decided I prefer to have one-trick ponies for my Actions. It takes a bit of extra time if I want to route to different destinations, but I know exactly where everything is headed. I think the most powerful Actions are the ones that append to a text file on Dropbox, since they do not require you to go to another app. This can be done with Evernote as well, but not for appending a note. You can append a note in Evernote using IFTTT if that’s something you want to do, but it’s an email action so it’s not as instant as appending a Dropbox text file. I just like the idea of being able to capture my thoughts in Drafts, and save to a log and be done with it.

I do send stuff to apps like Day One and Threadnote, but those require further processing. I’ll be honest, I’ve not yet decided on my ideal system so for now I end up sending stuff to multiple destinations. It’s a bit ridiculous, but I’m still playing around with plaintext journaling in nvALT while wanting to keep using Day One. And I like a lot of the stuff that’s going on in Threadnote. For now, I just log it all everywhere until I make my decision. At the very least, everything gets logged to a few master text files in Dropbox, and then routed to other apps as I see fit. Anyways…

There’s so much more you can automate with these basics as building blocks; I wanted to demonstrate just a few core examples that can get your brain working. This should give you enough code and enough real-use examples of some of the newer advanced features to help you create your own. If you come up with anything cool, let me know in the comments.

Advertisements

4 thoughts on “Advanced Tips for Drafts App

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s