Open Favorite Tweets on the Desktop

I’m a big fan of IFTTT.com, but one thing I missed was the ability to take actions on Favorite Tweets. This was a limitation in the Twitter API, but they’ve just restored this feature, which means I’ll be actually using Twitter again.

What I was doing before was using IFTTT to email me any links in Tweets that I favorite. I use this when I’m using Tweetbot and see an article that I want to read later. Sure, there are services like Pocket, but I seldom use them. And emailing them to myself is fine, but it too is tedious. So I set out to make this a little more automated. Turns out this is pretty simple.

Here’s the IFTTT recipe:

IFTTT Recipe: Open link tweets on my Desktop

This recipe just saves the link in the tweet in a text file in ~/Dropbox/IFTTT/Desktop. Running cat $file | xargs open will open it in the browser. You see where this is going?…

Next, I created a Folder Action Script using the AppleScript Editor. AppleScripts tend to be a black whole, IMHO, so I immediately pass off the AppleScript to a simple Bash script. Yes, its probably possible to do this in AppleScript. I don’t care. If you get it working, I might care, but probably not. You can see the AppleScript and the Bash scripts in this gist:

Four things you’ll need to do:

  1. Copy the applescript to ~/Library/Scripts/Folder Action Scripts
  2. Copy the shell script to ~/bin and make executable with chmod +x open-starred-urls.sh
  3. Attach the Folder Action. In Finder, right-click on ~/Dropbox/IFTTT/Desktop (make it if its not there) and select Services –> Folder Actions Setup… With your AppleScript in ~/Library/Scripts/Folder Action Scripts, your script should appear in the list. Activate it, and make sure that “Enable Folder Actions” is checked at the top of the box.
  4. Profit

Once you’ve set it all up, go favorite a tweet and watch your life fall into place.

UPDATE: I created another recipe, and refactored this a bit so that you can use the same script with a bunch of different services. Here’s another recipe that does the same thing when I star an item in the iOS app Reeder, using the Feedly service:

IFTTT Recipe: Open Starred Items on my Desktop

Advertisements