Toggle Asterisks and Hyphen Markdown List Markers Macro

October 26, 2013

Toggle Asterisks and Hyphen Markdown List Markers Macro → via @_patrickwelker

“Hello World”, this is just another post about one tiny tiny Keyboard Maestro macro.

I’m currently in the process of converting some lists from one format into another. This macro helps me speed up the process. It takes a Markdown list that has asterisks or hyphens as list markers and depending on which one it finds in the selected text switches to the other one. All indentation is kept.

So this…

- Sausages
    - Song
	    - Adam Buxton
		    - Great YouTube Video
    - Food
	    - ♥ of my dog

… becomes this:

* Sausages
    * Song
	    * Adam Buxton
		    * Great YouTube Video
    * Food
	    * ♥ of my dog

You might wonder how one could possibly need such a script if Markdown doesn’t differentiate between the list markers. Well, this becomes useful if you use apps like Listacular or any other app that has a feature which treats the list markers differently (there are quite a few)1.

This is the macro:


The only magic that is happening is an regular expression which went from this mess (picture) into this ([\t ]*)\*(.*) concise beauty (thanks to the clever folks at the Stack Exchange community).

PS: If you want to switch list markers on the whole document instead of just the selection add a type action with the ⌘A shortcut as the first action in the macro chain.


  1. Side note: I’m still hoping 1Writer will support or adapt a more Markdown friendly syntax for turning list items into todos. Using -- breaks working with those files for me.

Fetch and Push Notes from Dropbox - the poor man's sync

October 25, 2013

Fetch and Push Notes from Dropbox - the poor man's sync → via @_patrickwelker

Dropbox is indispensable on iOS. Apps like 1Writer with it’s support for creating folders and Launch Center Pro for iPhone which supports browsing your Dropbox and opening files are ready make working on your files a bliss.

Usually working with these apps is enough, but when I have a longer writing project I’d like to have a shortcut to open that particular file in my editor of choice and if I’m done I’d like to sync the changes back. It’s definitely faster if 1Writer isn’t your default editor and the text file is in another location than the one you specified in your default editor.

So, let’s keep this short and sweet and show you these two very simple x-callback-url’s which work as a manual sync solution for single files:

Requirements: Drafts and Launch Center Pro.

Fetching a Note

UPDATE: As it turns out my URL scheme to pull a note from Dropbox with Drafts is serpentine. It’s now officially filed away under “The U-Turn”

Thankfully Phillip Gruneich - who has a deeper understanding of URL callbacks than I do - showed me a shortcut which I’m going to share here:

Version 1 – Launch Center Pro:


Version 2 - Drafts:1

That’s it for part 1.

Dear reader, feel free to skip the U-turn subsection since it only documents how to complicate things. To jump right to part 2 press here with your mouse or finger now.

The U-Turn

(1) We use Lauch Center Pro’s new Dropbox action the specify the file whose content we want in our clipboard (here “iOS”).


Just use Launch Center Pro to create the URL and it takes care of percent encoding it for you. Result:


(2) Next we tell Launch Center Pro to open the clipboard as a new draft in Drafts.


Optionally, if you don’t want to edit the file in Drafts you could use an action which sends the text to the app of your choice. I stick with drafts since I think it’s an excellent editor.

The resulting decoded URL scheme:


Complete URL scheme (encoded):


For the passing on the clipboard it’s necessary to encode the second part of the URL like outlined in the Launch Center Pro documentation. Thankfully the app also has the capability to do that for you (see LCP’s clipboard actions).

Pushing the edited Note

This has become very easy thanks to the latest Drafts update which features a replace function – no more need to bring the heavy tools (Pythonista) to the game.

Open up drafts, create a new Dropbox action that looks like this:


Certainly not elegant or unique, but I happen to find it useful.

  1. I need to fix the code block issues with my Markdown parser. It wouldn’t display the code for the URL scheme properly. That’s way you see this nice tweet from Phil.

Keyboard Maestro Macros for URL's

October 24, 2013

Keyboard Maestro Macros for URL's → via @_patrickwelker

In my quest for the perfect plain text list management workflow I ended up with a few lists that only have the plain URL as list items (like * <>). For certain lists this was good enough since the URL slug usually tells me the story behind the link. In addition, having just an URL looked more concise in most editors, c.f. TaskPaper.

However, on the Mac I find myself using solely FoldingText for my list management. It has the nice feature to hide most of the Markdown markup and instead of [Polar Bears wearing kilts]( it presents me just an underlined Polar Bears wearing kilts. Well, that’s how I like my polar bears and that’s why I love FoldingText.

After realizing that all my links could look like that I decided to switch back to Markdown inline links. The problem was that I already had over 200 list items which were formatted as self-links. D’oh! What to do?2

Probably no one needs what I came up with, but I was in need for something that cleaned up the mess I made.

The brief: a script that is capable of spitting out nicely formatted Markdown links with the title of the web page when all it gets is a lousy URL.

In the process of coming up with the solution I ended up with three small macro’s that you can import into your version of Keyboard Maestro™.


Get all URL’s in the selection

Description: This macro copies the selected text and attempts to find all URL’s in it. You’ll end up with the list of fetched URL’s in the clipboard.



  1. Copies the selected text to the clipboard.
  2. Creates a temp file with the clipboards content.
  3. A shell script which strips everything else that isn’t a URL and generates a new variable (Linklist) which contains a list of all URL’s in the selection.
  4. Clean up → Delete the clipboard with the selection (we don’t need it anymore).
  5. Set the variable Linklist to the clipboard.
  6. Send a notification that all links are in the clipboard.
  7. Clean up → Delete the variable so it doesn’t show up in your library.

Disclaimer: The regular expression used in step 3 isn’t the approved & bulletproof “Accurate Regex Pattern for Matching URLs” by John Gruber. His one is clearly better, but I failed to get it to work with my simple shell script so I went with one from the RegExr Community.


Description: This macro is intended to use with just a single URL. It copies a selected URL, fetches the title of the web page from the Internet and puts a Markdown inline link in your clipboard.



  1. Copies the selected text to the clipboard.
  2. Makes a variable (URL) out of the clipboard.
  3. Initiates an IF condition that checks if the selection is an URL.
  4. If it is an URL it fetches the title of that URL’s web page and puts it in a variable (Title).
  5. Decode all HTML entities in Title to have a nice and readable title in the Markdown link.
  6. A small regular expression to lazy delete the leading and trailing whitespace.
  7. Strips the pipe character (|) from the title and replaces it with a dash. This is done because Kramdown - the Markdown parser in my Jekyll blog - always has trouble with the pipe character and assumes it belongs to a Markdown table.
  8. Deletes the trailing which the shell script created.
  9. Format the actual Markdown link with the two variables and put it in the clipboard.
  10. Send a notification that the link is ready and waits in your clipboard.
  11. If step 3 returns false, then output an error message that the selection didn’t contain an URL.
  12. Clean up → Delete the variables so they don’t show up in your library.


Description: This macro tries to grab all URL’s in the text selected. It grabs the title of the web page for each URL from the Internet and creates a list of Markdown inline links in your clipboard.



  1. Copies the selected text to the clipboard.
  2. Create a temp file with the clipboards content.
  3. Clean up → Delete the clipboard with the selection (we don’t need it anymore).
  4. A shell script which strips everything else that isn’t a URL and generates a new variable (Linklist) which contains a list of all URL’s in the selection.
  5. Time Intensive Process Warning Pt. 1 - Duplicates Linklist and names this variable CountURLs.
  6. Time Intensive Process Warning Pt. 2 - Counts how many URL’s are in the selection.
  7. Time Intensive Process Warning Pt. 3 - If statement for “when there are more than 9 URL’s in the selection”.
  8. Time Intensive Process Warning Pt. 4 - Send out a notification that the process will take a bit longer.
  9. Create an empty temporary file for appending the newly generated Markdown links to.
  10. If condition to parse every line (aka URL) in the Linklist variable and run step 11 to 17 repeatedly until all lines got their treatment.
  11. Fetches the title of an URL’s web page and puts it in a variable (Title).
  12. Decode all HTML entities in Title to have a nice and readable title in the Markdown link.
  13. A small regular expression to lazy delete the leading and trailing whitespace.
  14. Strips the pipe character (|) from the title and replaces it with a dash (see explanation in former macro).
  15. Deletes the trailing which the shell script created.
  16. Format the actual Markdown link with the two variables and put it in a variable (newLink).
  17. Append each newLink to the temp file created in step 9.
  18. Read all the new Markdown inline links and put them in the clipboard.
  19. Send a notification that the link is ready and waits in your clipboard.
  20. Clean up → Delete the variables so they don’t show up in your library.



The Why of Fitness Trackers

October 15, 2013

The Why of Fitness Trackers → via @_patrickwelker

This text is about motivation, the similarities between a Tamagotchi and fitness trackers, and also my general idea of why these things work in your favor and are more than superfluous gadgets.

The Tamagotchi Effect

Combining health and gadgets is like the carrot and the stick approach. The motivational aspect is definitely there. All fitness gadgets work with what I call the Tamagotchi effect. You have to care for your new little device, feed it with data and look after it – otherwise it will die, i.e., you’ll render it useless if you neglect it. In return, you gain a pat on the back if you were active and shall gain insight in the delightful visual representation of your doings – of course your sporty version of the Tamagotchi can also give constructive criticism and archive your activities.

Personally, I experienced the Tamagotchi effect quite a few times before. In 1995, when I was fourteen years old, I got this cool watch which went with the name Avocet Vertech as a Christmas present from my father. This gadget was one of the first altimeter watches ever brought to market, and I wore it on each and every snowboard ride. It was capable of measuring a ton of data: the vertical feet you rode, recorded the runs, maximum vertical rate, displayed the current and average rates, had an aircraft precision altimeter, a kind of weather station, all the standard functions of normal watches. Plus, you didn’t have to wait in line for the lift – you just need to press a button and it took you to the top of the mountain. Okay, I lied about the last feature, but that’s how futuristic it felt. I loved it.

Avocet Vertech and G-Shock

I also had a cheaper G-Shock watch for scuba diving, which I used to track the time under water. The problem with these early gadgets was that back in the days you data was inaccessible. For instance, you would have to populate your diver’s log manually. And, a day full of winter sport activity was overwritten the next day when you used the watch again. I didn’t even think about writing a log, and it hasn’t bothered me that this feature didn’t exist.

Well, that was back then… lets head on to the 21th century. More recently I made my first experience with some next-generation gear. I’d call it my first encounter with the first generation of next-gen fitness gadgets.

In 2006 Nike released their Nike+ sensor. It was placed inside a blank space in your shoes inner sole – the poor man’s version was to clip the sensor onto the lashes so that you could use it with every shoe. The chip with the sensor recorded the data. Back home you connected your iPod (with a cable, what else?) to your Mac and after syncing you could upload your data to Nike’s crappy flash website. From there, you were finally able to enjoy the visual representation of your stats and set goals or challenges with other users. This was 7 years ago which is ancient history in tech years.

The key point is that Nike+ got a lot of people, including me, into running. This was very unlikely to happen because I had a strange point of view on being passionate about certain sports. I never was into any of the classic sports, like track and field athletics or team sports. Well, before puberty kicked in I participated in a couple of them and even managed to get a brown belt in Kickboxing. But as a teenager those sports always stroked me as pretty boring and too regulated. That’s why I always preferred sports like Skateboarding, Snowboard and the like. Until my Nike inspired running epiphany, I never thought that I could enjoy a traditional sport. Before that it felt like comparing Classic and Jazz, with Classic being for those who like structure, order, regulation and only could play music when they have a sheet of notes in front of them, and Jazz being for the musician who is capable of improvising and expressing oneself much more freely. While there still is some truth in that some sports are more regulated than others, I dismissed my narrow-minded view and started accepting people’s passion for their chosen sport. After all, I like Classical music and Jazz, and there is no need to be nit-picky.1

The second next-gen experience came to my house in the form of Nintendo’s Wii Fit which got me into Yoga and classic home workout. Another thing I couldn’t image myself doing. I felt as indifferent about it as with the normal sports mentioned above.

With the release of Wii Fit and the balance board Nintendo brought something new to the market in 2007. Unlike other external controllers like EyeToy for Sony’s PlayStation which was released in 2003, this controller did focus on a new kind of gaming experience and merging it with another movement: fitness. The balance board and Wii Fit where a bundle that formed a unit which to me was the first successful fitness “game” ever made which made it into the living room. Even my parents, who aren’t into sports, were hooked the instance the stepped on the board and played their first exercise.

Sticking to the stick and carrot metaphor, the Wii Fit balance board was a different kind of carrot. The new technology and the fun you had with it was the real reward and motivation enough to exercise. The visual representation of your workout data was just the cherry on top. It’s no wonder that has become one of the best selling console games in history.

These were my first experiences with next-generation fitness gadgets. They worked as a gateway drug. In the first months, I couldn’t imagine going running without my tracker – I wanted the stats, and I wanted to archive them. I even decided against running even if I desperately wanted to just because the battery of the sensor was flat. But ultimately I decided not to care about it. After all, I enjoyed the sport enough not to depend on that gadget. It was the same with the balance board. While doing Yoga on it I always had to wait, there was no way to skip the short pause between the next exercise. Doing my Yoga workout without it felt much more like a fluid workout. It also saved my about 5 minutes.

I think Nike and Nintendo hit the mark with their products, and I will remember them for inspiring me that much. This is also why I’m curious to read about what developers will come up with in a few months when it comes to make good use of the new M7 chip in the iPhone 5S – a potential fitness gadget that several million of people already own and which might lessen the general interest in existing products of this category.

But we’re not there yet, so the next chapter is about what this new generation of fitness gadgets, the so called fitness trackers, do for you.

Push Notifications from your Body

One thing I’d like to tell you in advance is that I wouldn’t count any of the fitness tracking gadgets as an essential must have. Fitness trackers aren’t gadgets that one usually needs. They are want items. So what makes us want them in the first place?

I know that I haven’t moved as much as I should have in the last week and that my sleep pattern was terrible; I got way too little sleep. Matter of fact, our body constantly sends out signals; we get live status updates all the time. The older we get, the louder this bio alarm goes off. Still, the sad truth is that most of us have become accustomed to ignoring these frequent alarms. It’s just like with the kind of push notifications on our iOS devices which we haven’t incorporated into or accepted as part of our workflow. If we don’t interact with them, we tune out, be it consciously or subconsciously. After receiving a dozen of Facebook messages I didn’t care about I removed them completely from the notification center, for other notifications I settled with muting them.

It’s just the other way around with a fitness tracker: you deliberately decide to finally unmute the notifications from your body – you are willingly listening to the formerly muted tri-tone alert of your organism. In return, you get a visual representation of major parts which benefit your health, namely sleep and movement. It’s like you accept that digital warning sign right in front of you as an amplifier of how your body is feeling. So, the great thing about these health trackers is that you finally get the chance to take a look at the statistics and see how shitty you treated your body over the last week.

There’s also something new that happened over the last years: the birds eye perspective. We can take a step back a view our progress over weeks, months and even years. Besides from the fitness gadgets having become smaller and more functional each year, the biggest change that happened in the recent years is the rise of social media and web applications. Fitness gadgets entered the mass market and became more useful, even the data itself is more accessible than ever before. In theory, you now can do with your data whatever you want, the most popular gadgets have export functions and public API’s.

What really would be great is a common standard format which makes it simpler for users to export and import their data, maybe even to manage all their data under one roof. If these stats are amplifiers, then I’d like to listen to the music the play on more than one location. I’m positive that some clever people will think of a hub for all the data which users gather in different apps. Hopefully they will make it work for all of us. Exist is a web app that is currently in beta and has that noble goal in mind. I’m looking forward to it.

The sad thing about the status quo - having no open standard - is that company’s don’t get stimulated to use a format. I can foresee that I will wake up screaming in the middle of the night wondering why it isn’t possible to import and export my existing Nintendo’s Wii Fit U data to and from other apps. But this is Nintendo, they are proprietary gods… even more than Apple.2

Speaking of Nintendo’s Wii Fit U, they will also offer a tracking gadget.3 I can already see me wearing another device… possibly on a chain around my neck, then I have to find something to balance things out… maybe an old mac mouse in the middle just like that guy from the Robot Mafia.

robot mafia

If you counted right, you would arrive at a total of three gadgets, which I might end up wearing around my neck in a months time. That’s a sharp mind you got there, and this result is also the transition to the next chapter of this article.

My Fitness Tracker

I was toying with the idea of getting another gadget since I first heard about the Fitbit. Although I was happily running almost every day for 2 years without any tracking device, something changed. I was a bit too enthusiastic in my second year of running, and due to some old injuries I sustained while Skateboarding I managed to catch myself a chronic knee injury which prevents me from running longer distances. I had a short affair with swimming but running remained my favorite. Since I couldn’t do it anymore the way I used to – running longer distances – I became lazy. As a compromise, I started some light interval training which doesn’t stress my knee too much. I’m still lazy, so to find out how lazy I actually am, a fitness tracker seem to be the ideal tool. Therefore, I purchased my first next-generation fitness tracker, the Withings Pulse, which in my book is a third or fourth generation fitness tracker.

pulse package

Since I didn’t want to write a full product review (I think there are already enough out there in the wild), I’m just going to write some things of my chest:

Naturally, I don’t trust the values which the device generates 100 percent (and I trust calories burnt even less). But I knew before buying into the fitness tracker experience that those gadgets can’t be precise like professional equipment – whatever athletes and doctors use, I don’t think they would consider a Pulse or Fitbit an equivalentaquilvanet replacement.

My motivation to buy the Pulse was primarily to track my sleep patterns (and maybe make a connection to my physical activity). I use it every night, and the wrist band is very comfortable - it doesn’t bother me at all. I say this as someone who abandoned wrist watches completely.

So far this worked for me pretty well. I’m more aware of my sleep deficit and succeed in balancing things out more often.

Overall I enjoy the stats, I feel a tad more motivated and I’m keen to get more geeky, for instance integrating them into Panic’s Statusboard.

  1. On another note: there are also some people who swear by Windows. Imagine that, crazy, I know. But if they are passionate about it, there’s no real need to play the evangelist and tell them about why you think Mac’s are better – the you is not important when it comes to people’s personal choices.

  2. It’s cool enough for me that they finally decided to recognize the possibilities of an online store and the MiiVerse community – Wii Fit U and Wii Sports club will have much more of a social aspect thanks to this. I don’t care for facebooking my latest run, but when it comes to gaming this makes so much more sense to go a bit more Internet. Thanks Nintendo!

  3. Hilarious and loooong video ahead. Learn about the new haircut of the instructor and each and every step a Nintendo employee took while testing the new tracker (it feels like a real-time recording… way too long. I still made it to the end).