I love Twitter   3 comments

I love the idea of twitter – I think it’s the logical intersection between blogging and reduced attention spans.  I started to play about with it and I was frustrated with the way I needed to create entries.  Having a separate app to create twitter updates seemed wrong to me.  I don’t want to change focus from my current shell to create an update and best case, I want to update my status automatically so I don’t think about it, it just happens. 
 
I know that there are some command line tools to do this, but I I want a native solution for PowerShell, so I created a Send-TwitterStatus cmdlet to allow me to send updates directly from my shell.  Not only that, but I can use this cmdlet in other scripts to automatically push my activity to Twitter as well.  I created media player script and it seems like a natural thing to do is to push my playlist to Twitter so my friends can see what I’m listening to (if they want).  I have a line now in the script when I append an album to my playlist is a line that calls my cmdlet and pushes my update:
 
   Send-TwitterStatus "Adding to office playlist: $album" $credential
 
  • $album is the name of the album
  • $credential is a global variable that contains a PSCredential which is used by the cmdlet to authenticate with the Twitter service.  
I grabbed the Yedda.Twitter code to do the actual Twitter interaction and the rest is just the code to stitch the cmdlet together.  I also convert the XML results into a custom object so I can eventually create the appropriate formatting. 
 
Anyway – here you go. 
 
Here’s the Yedda.Twitter library
and the cmdlet code
My post http://jtruher.spaces.live.com/blog/cns!7143DA6E51A2628D!119.entry will show how to compile and install a snapin and use.
 
Next steps are to create the various twitter getters and create the format file so I can get activity directly from the shell.
 
 
 
 
Advertisements

Posted August 31, 2007 by jtruher3 in PowerShell

3 responses to “I love Twitter

Subscribe to comments with RSS.

  1. Great. Compiled with VS 2008.
     
    Worked liked a charm.
     

  2. Curious. I am able to take your C# code and post to Twitter.
     
    I took the key parts from Yedda and converted them to PowerShell.
    I get no no errors in the response and no posts to Twitter.
     
    If I pass an invalid password or userid I do get an access denied from the server in the script version.

  3. Hello Mr. Truher
     
    I work for Lab49 and we are scheduling a talk on PowerShell at Microsoft in New York for next Tuesday 9/18.
    I am wondering if there are any nuggets you could share about upcoming features, partnerships or other Microsoft products embracing PowerShell?
     
    Thank you,
    Doug
     
    blog:   http://dougfinke.com/blog/
    Lab49: http://www.lab49.com/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: