Understanding iOS URL Schemes – Opening a specific file in Notesy using Drafts

I have been trying to do some ios automation using Drafts, Lanuch Centre Pro, and Notesy. I have been failing miserably because I have no idea of the format for the whole URL Schemes. Yea, my though was – schemes – that is exactly what it is; I paid good money to do exactly nothing.

I wanted to create an action that would allow me a append text to a specific text file in my Notational Velocity Database. My normal procedure would be to load Notesy, find the note and then type my amazing, enlightened texts. Because when insipiraton strikes, I need to be ready (My other problem is finding inspiration – but in case I do find it I want to be ready).

I have been amazed at the things people automate with ios:

But, I feel that I am on the outside looking in and having no way to join the secret club. Apple does have some documentation on Url Schemes but they make no sense to a non-programmer. This site has a seachable index for Url Schemes. But, once again I am missing some fundemental information.

So I decided to play around to try and create my own url scheme.

Format

The devolopers of Notesy have laid out the available url schemes.


' notesy://x-callback-url/[action]?[x-callback parameters]&[action parameters]'


What the heck does this mean ? No idea but I played with Lanch Centre Pro, which allows you construct a URl scheme bit by bit. Unfortunately, with Drafts, you have to know what you are doing to start with – clearly not the case with me.

notesy://x-callback-url/append?path=Notational%20Data&name=blog&text=[[draft]]

This was the URL scheme I created after much playing around.

notesy://x-callback-url/

notesy://'

Both will open a blank file in the root directory. This was a good start. But, I wanted to open a specific file on Dropbox in my Notational Data folder, called "blog".

Actions

Notesy allows for a few actions:

  • open an existing note (use open action)
  • open to a folder (use open action)
  • send contents of note to another application (use open action with x-success parameter)
  • copy contents of note to the clipboard (use open action)
  • create a new note (use append action)
  • append text to an existing note (use append action)
  • open Notesy to its previous state (use restore action)
  • convert Markdown text to HTML (use render-markdown action)
  • send rendered Markdown to another application (use render-markdown action with x-success parameter)
  • have Notesy open another application after using the append, render-markdown, or open actions

The important actions were:

Open

Append

Since I wanted to add to a file, I chose append. Why is there a question mark after it – don't know, but seems important.

Path

The path describes the location of the file. In iOS, each application is an island. So, it does not matter that the file is on dropbox, Notesy calls it up. If I were accessing a file on the root directory, I would not need a path. But, the file in is the folder : Notational Data.

I found this hard, to figure out, but just typing Notational Data into Launch Centre Pro, the app provided me with the URL. I think this is some really basic information that everybody on the planet knows, except me. Turns out that

path=Notational%20Data

you need to add %20 for spaces in the folder name. If I needed to go deeper in a folder structure:

notesy://x-callback-url/open?path=dir1%2Fdir2

Text

Finally, I wanted to add my enlightened text:

the &text= tells Notesy what text to place in the file . If it is left blank, Notesy will append the clipboard text.

Drafts allows you to add specific things to the file:

  • [[draft]] the body of the amazing text you composed
  • [[title]] the title of this stupendous body of work; this is the first line
  • [[text]] everything except the first line

I hope this article was uselful. There are some amazing tutorials out there, describing some detailed workflows. But, my eye glaze over, because I am lacking in the fundamentals. I feel this way every time I read some detailed workflows at Mac Stories. Sometimes, it is good just to cover the basics and hope not too many people were bored.

Advertisements

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

%d bloggers like this: