Technology

  • quicksilver
  • twitter

QuickSilver

Twitter

Sometimes you just want to pop of a quick tweet via quicksilver

note already had password in Twitterific, so just use the password from that.

using terms from application "Quicksilver"
  on process text tweet
    my growlRegister()
    
    set wordcount to do shell script "echo " & quoted form of tweet & ¬
      " | wc -c | sed 's/^[   ]*//'" --there is a space and tab in there
    if wordcount as integer > 140 then
      my growlNotify("Tweet too long", "(" & wordcount & ") characters")
      return nothing
    end if
    
    try
      --get password from http://blog.dimbert.net/2007/01/30/itwitstatus/
      tell application "Keychain Scripting"
        set twitter_key to the first generic key of current keychain whose name is "Twitterrific"
        set twitter_login to quoted form of (account of twitter_key & ":" & password of twitter_key)
      end tell
      
      set twitter_status to quoted form of ("status=" & tweet)
      set results to do shell script "curl --user " & twitter_login & " --data-binary " & ¬
          twitter_status & " http://twitter.com/statuses/update.json"
      
      my growlNotify("Tweet Sent", tweet)
    on error errmsg
      my growlNotify("error", errmsg)
    end try
  end process text
end using terms from


using terms from application "GrowlHelperApp"
  -- Register Growl
  on growlRegister()
    tell application "GrowlHelperApp"
      register as application ¬
        "Tweet" all notifications {"Alert"} ¬
        default notifications {"Alert"} ¬
        icon of application "Twitterrific.app"
    end tell
  end growlRegister
  
  -- Notify using Growl
  -- Example: growlNotify("This is an Alert","This is a test of the Growl Alert System")
  on growlNotify(grrTitle, grrDescription)
    tell application "GrowlHelperApp"
      notify with name "Alert" title grrTitle description grrDescription application name "Tweet"
    end tell
  end growlNotify
end using terms from