Archive for the ‘Mac’ Category

  1. Twitnews update

    Sometime back I posted an applescript to tweet news items in NetNewsWire to your twitter followers and seems like many people found it useful. I’m really glad that I could find some time today to make a few updates on the script.

    New features

    • Twitnews now saves your twitter login details to the keychain itself. The old script needed you to save your twitter login credentials to the system keychain manually. Now, it checks for the twitnews key in your keychain and if it does not exist, asks you for them and creates the key for you.
    • Growl support.
    • Checks character count is within 140 characters.
    • Uses URL shortener so that you can use analytics feature if you use it.

    I would however like to use Usable Keychain Scripting by Daniel Jalkut of Red Sweater Software, considering the problems faced by some users, which I blame Apple for their really bad implementation of Keychain Scripting. I tried using Daniel’s scripting definition but could not get it to work, probably it is not updated for Snow Leopard. I’m not sure about this, so if you have suggestions on how I can improve the script, please leave your comments.

    Please download it here.


    Unzip and drop it into ~/Library/Application Support/NetNewsWire/Scripts. Now you can access the script from the scripts menu on NetNewsWire.

    If you would like to assign a keyboard shortcut to the script, check this post.

    What else ?

    The script has been tested on 10.5 and 10.6, but still if you find it buggy, please let me know in the comments. Otherwise, I hope you find it useful.

    The code is available at Github.

    UPDATE: If you’d prefer to use URL shortener, the script has been updated by Sean to use for click tracking.

    UPDATE: has been shut down :( Please see this post for an updated script.

  2. Add more Readability to NetNewsWire

    If you are reading this post on my blog using Readability, then you are probably gonna love this. For those, who have not heard about Readability, it is a nifty little tool by Arc90, which transforms a webpage or blog post you are looking at to something very friendly to your eyes, or just increases the ‘readability’ as the name implies. From day one, I’m in love with it. If you haven’t yet, go check it out.

    Coming back to the post, I discovered this really nice tip that helps to get Readability installed on NetNewsWire (yeah, your favorite news reader), using Applescript. It is very useful because you probably read all your news subscriptions on your news reader. So here you go!

    Hint: I recommend adding a shortcut to the script once you have set it up. See this post if you’d like to know how you can do that.

  3. Tumblr Dropzone

    Screen shot 2010-01-17 at 2.27.04 PM.png

    If anyone of you is using Dropzone app, I’ve made a small script to post images to the fun blogging platform – Tumblr. If you haven’t used Dropzone, it is a very useful mac app that lets you easily drag and drop files to perform customizable actions on them. For example, to upload the file to remote destinations, like your own FTP servers, Flickr, Posterous, Twitpic to name a few. But it is not just limited to file uploads, other uses include zipping and emailing the files you drop on it, install mac apps easily, share code on Github Gist or Pastie etc. Smoking Apples has a good review on the app.

    I mainly use it to quickly share screenshots I take while on work, and also to quickly share a file with someone else on my FTP server.

    The very good point with Dropzone is that the developers have made it very easy to extend the app with its API. If you are fine doing away with Ruby, then you can build your own destination scripts. I’ve just tried my hand on it, with a simple script that uploads the dropped image to Tumblr. I tried both the Net::HTTP method and also using Curl. However, using Curl seems to be quite faster.

    The code is at my fork of Aptonic’s user contributed scripts at Github.

    I believe that this app has got great potential and hope to see more extended scripts in the future and also will try creating my own if I get the time.

  4. TwitNews Keyboard Shortcut

    Some time ago, I wrote an applescript ‘TwitNews‘ for posting link to news items to Twitter from NetNewsWire. Many people seemed to find it useful and I’m happy about it. Today morning I got an email about how he used Spark app to create a keyboard shortcut to use the script. That is really useful because you dont have to select TwitNews from the scripts menu anymore. Instead just hit the assigned keyboard shortcut. That really gives it a native feeling. Unfortunately, I could not get Spark to work. Instead I found that it is much easier to use Mac OS X inbuilt feature in System Preferences -> Keyboard & Mouse -> Keyboard Shortcuts.

    Just create a new keyboard shortcut with the Application as NetNewsWire, Menu title as ‘TwitNews’ if you haven’t renamed the script when you put it inside the scripts folder, and your desired keyboard shortcut. I chose ⌃T as it is the same shortcut with Safari140 which is a useful tool to post stuff to Twitter from Safari (if you didn’t know).

    Thanks to Ian Tornay for the idea of keyboard shortcuts!

  5. Push notifications put to best use

    Prowl - Preferencesprowl-push

    Just came across this cool iPhone app called “Prowl” which pushes growl notifications on your mac to your iPhone. An awsome way of using push notifications introduced in iPhone OS 3.0. I knew this app was going to be useful that I finally made up my mind to jailbreak my device. Yes, I have an unlocked iPhone and somehow you need to hack it to activate push notifications.

    A lot of mac apps I have come across uses growl and it has been an inevitable part of my mac setup. So, any growl notification you get on your mac gets routed to your iPhone. This means that you can set Tweetie on mac to growl when you have a mention or direct message, which is then routed to Prowl’s servers and onto your iPhone. Furthermore, you can configure to growl when you get new emails (GrowlMail), or when someone sends you a message on Adium – really useful so that you can know if someone messaged you on IM when you’re away from your mac.

    Prowl lets you customize it by giving options like send to iPhone only if you are away from your mac for a certain amount of your time. Which is sensible, you really dont want to get push notified when you are in front of your mac. Prowl works with a Growl plugin and its iPhone app. You also need to register on their website to activate it.

    Even tried this on EDGE and seems to work fine. But sometimes, there is a lag in pushing notifications which is not impressive. Also, after enabling push notifications, I found that the battery life has gradually decreased. But, I think this app is really worth it.

  6. Things vs The Hit List


    I had been craving for a decent app for managing and scheduling my tasks forever. As soon as I got my new mac, I was constantly searching for one. Until one day I found what I need – Things by Cultured Code. Things really does give, what all of us have been whining for. As they say, it simply just makes you forget your tasks giving you the piece of mind that it will remind you of them at the right time. Also, having bought the Things for iPhone, it was very easy to create or strike off tasks on-the-go. Now, I feel I’m more organized. Kudos to GTD.

    Recently while checking out the new task management app for the mac The Hit List, I found more ways to make use of it. It looked pretty sleek and the main advantage of it over Things is that it makes it more easier to manage your task – with easier and better usage of tags and contexts. Also I think the way Hit List segregates tasks into sub tasks is a better implementation of GTD. Of course you can do this with projects in Things but THL makes it more lucid. The keyboard shortcuts in THL makes it more deserving. Now I’m confused which one to use. The lack of an iPhone counterpart sure does make a difference but the developers have promised to deliver one very soon – however, there is not one right now. So I think I should just stick with Things at the moment.

    Something that annoys me about ‘Things for iPhone’ is that it does not sync automatically with the desktop. It syncs every time you start up the app on your iPhone and the irony that it does not sync back again after you quit the app – leaving un-synced tasks on the iPhone – fail !! Hopefully, with the much anticipated Push notification service on iPhone OS 3.0, this should be possible.

  7. TwitNews – Post to Twitter from NetNewsWire

    Just mashed up a quick applescript to post the currently selected news item in NetNewsWire to Twitter. The code is highly influenced from TwiTunes, (which posts the current track on iTunes to Twitter) and the Shorten URL script from iconmaster. So all credits goes to them.

    By default, the contents of the tweet is set to the title of the news item and the URL is shortened using and you can easily customize it.

    The script needs you to save your Twitter login credentials in your keychain or else you will get an error. To do this, tell Safari to save your login details to Keychain while you login to Twitter or you can do it manually in the keychain app by selecting ‘New password item’ and set Keychain item name as and fill in your Twitter username and password in the following fields.


    Download the script TwitNews, uncompress and drop it into ~/Library/Application Support/NetNewsWire/Scripts. Now you can access the script from the scripts menu on NetNewsWire.


    If you want to have a look at the code:

    tell application "NetNewsWire"
    if index of selected tab = 0 then
    -- We're looking at headlines, so just get the headline URL
    set feed_url to URL of selectedHeadline
    set feed_title to title of selectedHeadline
    -- We're looking at a web view tab, so we need to know which tab
    set i to index of selected tab
    set i to i + 1
    -- Get the tab's URL
    set URL_list to URLs of tabs
    set title_list to titles of tabs
    set feed_url to item i of URL_list
    set feed_title to item i of title_list
    end if
    -- Build the GET request for the API
    set feed_url to "" & feed_url
    -- Submit the GET request and copy the results to clipboard
    set cmd to "curl " & feed_url
    set feed_url to (do shell script cmd)
    end tell

    -- change the status message to your liking here:
    set tweet to feed_title & " " & feed_url

    -- let the user edit
    display dialog "Edit your Twitter status" with title "TwitNews" default answer tweet cancel button 1 default button 2 buttons {"Cancel", "Send"}
    set tweet to (text returned of result)

    -- get login from keychain
    tell application "Keychain Scripting"
    set twitter_key to first Internet key of current keychain whose server is ""
    set twitter_login to quoted form of (account of twitter_key & ":" & password of twitter_key)
    end tell

    -- post to twitter
    set twitter_status to quoted form of ("status=" & tweet)
    set results to do shell script "curl --user " & twitter_login & " --data-binary " & twitter_status & ""

    Hope you find this useful and feel free to make any changes as you need.

    UPDATE: You might want to check this post to assign a keyboard shortcut to the script.

    UPDATE: There is an updated version available with some new features. Please see this post.

  8. iPhone on Rails

    Just stumbled upon this awsome new framework called ObjectiveResource which helps you to make your native iPhone application talk to Rails based web services very easily.

    Getting Started with Objective Resource from Josh Vickery on Vimeo.

    Visit iPhoneonRails for more information.

  9. Autotest Rails with Growl

    Now, this is really cool stuff. Autotest is a part of the ZenTest package which helps you to run your tests in the background in your Terminal while you can continue writing your tests. Which means you don’t have to frequently visit your terminal just to fire away ‘rake’ to test your Rails application. Autotest runs them in each save to the test file you are working on. But unless you have a dual monitor setup, its going to be a bit of useless feeling because you may have to check whether the tests run OK. Thats where Growl comes !


    You can set Autotest to send the test results as growl notifications in Mac OS X. It is really cool if you set it up in the right way.

    First, if you don’t have autotest install it by running:

    sudo gem install ZenTest

    Now, you can hop into your Rails root and fire away autotest by:


    You can see the tests running, but it would be great if you could have some better feedback in the Terminal – like green for success and red for failure. This can be achieved through plugins in autotest. This is already installed when you install the gem but you just have to tell it to load them.

    Create a file named ‘.autotest’ in your home directory and enter the following:

    require 'autotest/redgreen'

    Start autotest and you should see some better feedback. Note that you need to press ^c twice to stop autotest because pressing ^c once, will reset autotest and run the whole test once again.

    Now lets get growl working. For this to work, you need to install ‘growlnotify’ which is a command line utility to send growl notifications. You can find growlnotify in the Growl disk image which you used to install growl (inside Extras). Note: I had to set a path to /usr/local/bin to get growlnotify to work.

    You can check whether grownotify is installed fine by issuing this command from the terminal:

    growlnotify -m "This should be growled !!!"

    To enable growl with autotest, insert the following in the .autotest file:

    require ‘autotest/redgreen’

    module Autotest::Growl
      def self.growl title, msg, img, pri=0, stick=""
        system “growlnotify -H localhost –image #{img} -p #{pri} -m #{msg.inspect} -t #{title} #{stick}”

      Autotest.add_hook :initialize do |at|
        growl “Autotest Started”, “Running…”, ‘~/Stuff/Growl_Icons/rails_ok.png

      Autotest.add_hook :ran_command do |at|
        output = at.results.last.slice(/(\d+).*errors/)
        if output =~ /ns.*[1-9]/
          growl “Test Results”, “#{output}”, ‘~/Stuff/Growl_Icons/rails_fail.png’, 2
          growl “Test Results”, “#{output}”, ‘~/Stuff/Growl_Icons/rails_ok.png’, -2


    You can grab the images used in the script from below and link to them appropriately. Also note that I have used priority of -2 for success and 2 for failure which means low and high priority respectively. You can set the background for these priorities in your growl preferences so that you get a much better feedback through growl (you can see mine above).

    rails_fail.png rails_ok.png

    Happy testing :)