Deprecated: Return type of I::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 62

Deprecated: Return type of I::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 91

Deprecated: Return type of I::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 71

Deprecated: Return type of I::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 101

Deprecated: Return type of I::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/i.php on line 53

Deprecated: Return type of Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/public/kirby/toolkit/lib/collection.php on line 80

Deprecated: parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in /home/public/kirby/toolkit/lib/url.php on line 135
One Tap Less | 2013 in Review: Groceries After Work

2013 in Review: Groceries After Work

The first action I wrote for this blog was Groceries After Work, where you’d write your groceries list on Drafts and it creates an event in Fantastical to tell you to shop at a specific time that day, then it sends your list to Clear or Ita. The trick is that the Fantastical event also has a link to the list. When the event nags you, you can just tap the link to open the grocery list. It’s time to review this action and update it to current standards.

First, Flexibits released Fantastical 2 and the url scheme changed to fantastical2://. While we wait for Ita’s update to iOS 7, you can use Clear on the iPad with the new universal app. Comma-separated lists are still an issue, but you can overcome that using Launch Center Pro new [prompt-list], however, that means you’ll miss the [[date]] parameter from Drafts to grab the current date. Man, what a crossfire.

Let’s take a look at the original Drafts action for reference:


It will parse an event titled Go to the supermarket on Fantastical, set its url to a link to the Clear list named Groceries, set the start date to today at 19:00 and the end date to 30 minutes after. Then it will open Clear and add the items to the Groceries list. What’s the best tool to launch this chain of events? Drafts or Launch Center Pro? Notice how we use the [[draft]] tag twice for the callback parameters, which would require LCP to prompt us both times1 for the same information. Therefore, I’ll stick with Drafts for this action and look for a way to avoid the comma-separated list.

This is the revamped version of the same action, using TextTool to counter the comma separated lists:

Groceries After Work:


TextTool is an app to manipulate text in many ways, you can encode, entab and even use regular expressions. In this action, TextTool will grab or multi-line list written in Drafts and turn it into a single line, separating each value with a delimiter using the join and since its default value is the comma, we don't have to specify anything. By default, TextTool will set the outcome of the transformation to the clipboard unless you set the clipboard=0 parameter, which we do. Afterwards, we set the x-success parameters to take us to Fantastical 2.

Notice how every content is manually encoded as well, although the entire x-success parameter is wrapped in chevrons. Explaining why this has to happen would be lengthy, but save yourself the trouble and use TextTool to encode your strings, it works like magic.

Look how we're creating a reminder instead of an event and setting a due date to it. Reminders integration is one of the many new feature of Fantastical 2. Another cool trick is to include add=1 to your action, which will automatically add the reminder or the event and move to the callback. However, using the add parameter can be tricky as it won't work if you place it after the callback parameters2.

We once again use title instead of sentence, but now that's optional as Fantastical will identify the Clear url scheme and set the action as a url. Therefore, you could pretty much set a single sentence to Remind me to Go to the Supermarket today 7pm clearapp://list/show?listName=Groceries3 and the action would look like this:

Groceries After Work 2:


These two actions leave the x-cancel out because we use the add tag4, but using it would allow you to add lists to your grocery list from a single action if you had already created the reminder and avoid duplicate reminders. This how the action would look like using the x-cancel parameter:

Groceries After Work with x-cancel:


I showed only the first example because it is quicker, you'll barely see Fantastical and TextTool bouncing on your screen. If you want the action using the sentence parameter instead, tap here. If you don't have TextTool or Drafts, you can also trigger this action from Launch Center Pro, however, you'll have to skip the x-cancel to avoid being prompted twice, as I wrote earlier. The LCP action uses [prompt-list] to insert the commas between every list item, the action would look like this:

Groceries After Work LCP:

fantastical2://x-callback-url/parse?add=1&sentence={{Remind me to Go to the Supermarket today 7pm clearapp://list/show?listName=Groceries}}&x-source=Clear&x-success={{clearapp://list/create?listName=Groceries&tasks=[prompt-list]}}

I guess this covers all of it, doesn't it? You learned today about TextTool, a couple of tricks from Fantastical 2 and that Clear+ still requires comma-separated items. We built the action in 4 different ways to be used on Drafts and one if you prefer Launch Center Pro. Enjoy your groceries and don't forget the toilet paper.

  1. Would be nice to have a way to reference a previous prompt using its title as a call parameter in LCP. 

  2. At least it didn't work in my tests. 

  3. Funny story: if you open Fantastical and paste that sentence in the window to create an event, it will render the string correctly, however, if you try to add it from the Reminder window, it won't get Clear's url, I guess it looks for a priority in that place, but I was unable to set it using natural language, the exclamation marks apparently don't work in this case. 

  4. Check the position of the add tag in the last action, before the sentence tag, couldn't make it work when set after.