Tweet This Post

The following is inspired by Using Launch Center Pro 2, Drafts, and Dropbox to List Down My Expenses by Dexter Ang.

I am currently using a TiddlyWiki to keep track of spending. I have written actions for both Launch Center Pro and Drafts to enter expenses and then have the data prepended to a text file in wiki table format. At my convenience, I can then copy a row from the table and paste it into the appropriate financial category tiddler. (Note that all of the following can be used to simply add a running list of expenses into a Markdown table in a text file -- you don't need to use a wiki with these actions.)

A row in a wiki- or markdown-table looks like this:

|2014-02-12|Groceries|$14|

The LCP action uses the TextExpander snippet to enter the date, and uses prompts to enter the type of spending and the amount spent. These three fields are separated by an URL-encoded pipe (|), and then the entire string is sent to Drafts to launch the moneyWiki action. Upon success, I am sent back to LCP.

drafts://x-callback-url/create?text=<ddate>%7C[prompt:Where and What]%7C%24[prompt-num:Amount]&action=moneyWiki&x-success={{launch:}}

(%7C is an URL-encoded |. %24 is an URL-encoded $.)

In Drafts, moneyWiki is a Dropbox action in which I prepend the following to the money.txt file in my /Apps/TWSync/Text/ folder in Dropbox:

|[[draft]]|

(The folder can be of your choosing. I use TWSync because that's where TWEdit syncs TiddlyWiki files.)

When the [[draft]] is surrounded by pipes, the result is a valid table row. The advantage of this action is that I can enter something like 2014-02-12|Groceries|$14 into Drafts, trigger the same moneyWiki action, and once again have a valid table row prepended into my money.txt file. (In other words, I can enter expenses into LCP on-the-go, or enter into Drafts so that I can act upon the draft later -- for instance, if I do not have internet access.)

Addendum: A Note About Markdown Tables

After reading more about tables in Markdown, I've learned that Markdown proper doesn't include special formatting for tables, but extensions like Github Flavored Markdown do. In this case, a table must have a header to render properly. If you're going to use a header, then obviously you cannot prepend new expenses to your text file, you will have to append instead.

02/11/14; 10:51:54 AM

Tweet This Post

I've played around with Dave Winer's River 2 and River 3, but ultimately these solutions are expensive because they require a server to process the RSS feeds included in an OPML file. (Here's Dave's River so you know what it looks like.) I used to run my River using EC2 for Poets and the Amazon Web Services bill was way too high just to publish a feed reader.

Fotis Evangelou has developed a client-side feed reader based on javascript called AMJR (Asynchronous Multifeed JavaScript Reader). I've adapted his slightly for my own "river" about iOS Automation. All I had to do was create my own list of feeds and do some tweaking of the CSS and HTML to remove the fixed content area on the right.

Like the OPML Editor River of News, there are no bells and whistles here. You can't read full feeds within the "app" or 'Send to Instapaper' or star an item to save it in Pinboard. But it's a good way to just view headlines from your favorite feeds. And because it's a static app and the work is done in the browser, you don't incur server costs beyond just hosting the files somewhere.

02/07/14; 04:59:03 PM

Tweet This Post

Plain text rocks, but I've been crushing on the list-making iOS app Paperless recently, and because it stores its data in XML files (at least when using Dropbox for sync), it's difficult to mark an item complete in a text editor. However, it's not impossible.

I would not advise the following steps to anyone other than those who are comfortable editing XML files.

To find the XML files, just go to the \Paperless folder in Dropbox. A typical list item will look like this:

<item>

<dateCompleted></dateCompleted>

<itemName>Cell phone bill</itemName>

<itemNote>$100</itemNote>

<itemReadOnly>NO</itemReadOnly>

<itemCompleted>NO</itemCompleted>

</item>

To mark as complete, we have to do two things:

  1. Enter a value for <dateCompleted>

  2. Change the value for <itemCompleted>

<item>

<dateCompleted>2014-02-06 15:32:11 -0500</dateCompleted>

<itemName>Cell phone bill</itemName>

<itemNote>$100</itemName>

<itemReadOnly>NO</itemReadOnly>

<itemCompleted>YES</itemCompleted>

</item>

Above, I've changed the value of <itemCompleted> to YES. I've also entered a date string for <dateCompleted>. If you use TextExpander, use this data math for the snippet:

%Y-%m-%d %H:%M:%S -0500

The app uses +0000 UTC time, but above I've chosen -0500 because I live in New York. When I re-sync the app with Dropbox, it shows at the bottom: "Completed: Feb 6, 2014, 3:32 PM" so I know I did the date math correctly.

02/06/14; 03:18:44 PM

Tweet This Post

After reading this Twitter conversation between @welkpatrick, @epramono and @Pgruneich, I now have a deeper understanding of how launch://?url= works:

Combined with Federico Viticci's Safari Action Menu In Launch Center Pro, it's all starting to come together: I can write a Launch Center Pro action, and use it from within another app entirely, without having to have that action entered in LCP itself.

For example, I have an action in LCP to add an item and optional note to Paperless:

paperless://addItem?itemName=[prompt:Item]&itemNote=[prompt:Note]&toListNamed=[list:Choose a list|List1|List2|List3]

(You can view that URL Scheme documentation here.)

Now, if I've noted something in Drafts and later decide I want to send it to Paperless, I can just tap on the paperlessList action in the Drafts Actions menu to launch LCP with a menu of lists already open. All I have to do is tap on the list to which I want to send the task, and the task and note are imported into Paperless.

If you're in Drafts, tap on this link to import the URL Action. And here is the action itself:

launch://?url={{paperless://addItem?itemName=[[title]]&itemNote=[[body]]&toListNamed=[list:Choose a list|List1|List2|List3]}}

The first line is the task, and any additional lines (if they exist) are added in the note field.

02/06/14; 10:01:02 AM

Tweet This Post

I wrote the above Launch Center Pro action over the weekend. I thought it would take 15 minutes, but it took 45, because the encoding was such a challenge.

The Problem I Wanted to Solve

When I add new list items to an LCP action using the list tag, I sometimes just randomly add an item after the first pipe (|) I can find. Then I notice that the order of my list items has no rhyme or reason to it, so I want to alphabetize it. This is not an easy task, cut-and-pasting in a small text area on an iPhone screen. So I decided to use TextTool to automate the process for me.

  1. Remove the pipes in a sequence like Apples|Pears|Bananas using the split method.

  2. Use the sort method to alphabetize the list

  3. Add the pipes again between each item, using the join method.

Here is the full LCP action (click on the link in the Twitter embed above to install):

texttool://x-callback-url/transform?text=[clipboard]&method=split&delimiter=%7C&x-success=texttool%3A%2F%2Fx-callback-url%2Ftransform%3Ftext%3D%5B%5Boutput%5D%5D%26method%3Dsort%26x-success%3Dtexttool%253A%252F%252Fx-callback-url%252Ftransform%253Ftext%253D%25255B%25255Boutput%25255D%25255D%2526method%253Djoin%2526delimiter%253D%25257C

The sort transformation, URL-decoded:

texttool://x-callback-url/transform?text=[[output]]&method=sort

The join transformation, URL-decoded twice:

texttool://x-callback-url/transform?text=%5B%5Boutput%5D%5D&method=join&delimiter=%7C

Notice how, even though this action was URL-encoded twice after the second x-success parameter, the [[output]] had to be encoded yet again before the entire action was URL-encoded twice. I had to add an extra %25 before each double-encoded bracket to make the complete action work.

Related: Take a Photo, Get a Markdown Image Link with Launch Center Pro, Clean Links, and TextTool

Resources: TextTool x-callback-url Support page

02/03/14; 10:33:23 AM

Tweet This Post

Paperless is an iOS lists app that stores its data in XML files in Dropbox (if you choose to sync). What follows is an attempt to procure the first item in a list and send it to Due without having to copy and paste.

The first list item in any Paperless list appears to occur on line 12 of the list's XML file. It looks like this:

<itemName>LIST ITEM</itemName>

Launch Center Pro's dropbox tag lets you get the contents of a text file, so I figured I could grab the entire contents of an XML file and push it to Drafts. Tap on this link to import into LCP, or copy the action below and adapt for your purposes:

drafts://x-callback-url/create?text=[dropbox-text:Paperless/Errands.xml]&action=line12

What this does is grab the full text from the Errands list in Paperless, send it to Drafts, and then activate the line12 custom URL action.

line12 uses a Drafts tag [[line|12]] to send line 12 of the XML file to TextTool and then use the regex method to replace <itemName> and </itemName> with blank spaces. I know next to nothing about regex, but I found here that I could easily create a regex expression to match both <itemName> and </itemName>:

<(/|)itemName>

So the search parameter in TextTool is the above URL-encoded, and the replace parameter is a single space, URL-encoded:

texttool://x-callback-url/transform?text=[[line|12]]&method=regex&search=%3C(%2F%7C)itemName%3E&replace=%20&x-success=due%3A%2F%2Fx-callback-url%2Fadd%3Ftitle%3D%5B%5Boutput%5D%5D

(Tap on this link to import into Drafts.)

The x-success parameter above tells TextTool to take the [[output]] of that transformation and send it to Due. Here is that action URL-decoded:

due://x-callback-url/add?title=[[output]]

The final result... I tap on the LCP action, and it adds the first list item from my Errands list and sends it to Due. There are spaces preceding the text, but the XML is extracted.

Although the automation required to perform the above is a bit excessive (in contrast to just copying an item from Paperless and then pasting it into Due) it demonstrates the ability of the included iOS apps to accomplish pretty remarkable tasks.

 

Addendum (2014-02-04)

Here is an importable line12 Drafts action that trims the TextTool regex output before it sends the list item to Due. And here is the URL action itself:

texttool://x-callback-url/transform?text=[[line|12]]&method=regex&search=%3C(%2F%7C)itemName%3E&replace=%20&x-success=texttool%3A%2F%2Fx-callback-url%2Ftransform%3Ftext%3D%5B%5Boutput%5D%5D%26method%3Dtrim%26x-success%3Ddue%253A%252F%252Fx-callback-url%252Fadd%253Ftitle%253D%25255B%25255Boutput%25255D%25255D

 

Addendum 2 (2014-02-04)

Here is an importable line12 Drafts action that will include a link to the Errands list in Paperless within the Due text, so that when you complete the task, you can visit the list and check off the item there. (Thanks to @epramono for inspiring this.) And here is the URL action itself:

texttool://x-callback-url/transform?text=[[line|12]]&method=regex&search=%3C(%2F%7C)itemName%3E&replace=%20&x-success=texttool%3A%2F%2Fx-callback-url%2Ftransform%3Ftext%3D%5B%5Boutput%5D%5D%26method%3Dtrim%26x-success%3Ddue%253A%252F%252Fx-callback-url%252Fadd%253Ftitle%253D%25255B%25255Boutput%25255D%25255D%25250Apaperless%25253A%25252F%25252FviewList%25253FlistName%25253DErrands
02/03/14; 12:47:01 PM

Last built: Tue, Mar 31, 2015 at 2:05 PM

By Jeffrey Kishner, Monday, February 3, 2014 at 10:33 AM.