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.