Posting to Twitter from the Command Line (And from Dash)

Twitter is a great tool for me and I like being able to post, but sometimes I wish it were more convenient to do so. Sure there are plenty of apps and widgets, but I wanted something that would let me post from a command line. Not an interactive app, just type and go. I didn’t see anything for it, so I ventured off on my own.

First, I saw that Twitteroo had a .NET library for Twitter. So I built my client with that. After a while I realized that Twitteroo does a lot more than I need, so with the aid of Reflector, I found just the lines that I needed, and copied and pasted into my own code.

Now I can type contwit “This is a status update” and “This is a status update” will show up on my Twitter account. So how did it know who I am? Well, if you just type contwit with no parameters, it asks you for a username and password. These are stored in an encrypted string in a configuration file in the same directory as the executable.

Now, that’s pretty cool and all, but it still didn’t make it much easier to use. Enter Dash. Dash is the App Launcher I use. I just type -<-> and a little window pops up. I can then type what I want to launch and it launches it. I don’t even have to type the whole command because it autocompletes. Visit the site. It works really well.

So with Dash, I end up typing -<->twthis is my status update and I am done. But my app is a console app and I hate having the console window pop up. Sure, I could write the app as a windowless Windows app, but I am lazy. So to cure this I use HStart from NTWind. This is a great tool that launches any command line app from a hidden window. The options are a bit confusing so here is my Dash command line:

Path: hstart 

Arguments: /NOCONSOLE “”C:Program FilescontwitContwit.exe” “*ALL*””

Note the double quotes, those are important.

Update

Wow, its been some time since I last posted here. Lots of travel, and mostly being sick. I moved into my new apartment at the end of January and then about 2 weeks later I got sick. Very Sick. 2 weeks later, I got on a plane to go to Argentina…still sick. Then I spent a hard week of working in Buenos Aires (It WAS alot of work), while still sick. Then a week in Seattle. I thought I had gotten better but then a tickle in the throat started. By the end of the week I was feeling like death again. The flight was hell and when I landed in Amsterdam, my ears hadn’t popped. The taxi back to my apartment was tough, constantly coughing. An hour in my apartment to shower and repack a bag, and I was off to Central Station for a train to Brussels. I was actually heading to a much smaller town south of Brussels where Dialogic has an office. Dialogic is a very important partner for Captaris and I was going to attend a Fax over IP class they were holding. I was to change trains at Brussels North, but the connecting train got cancelled…twice. An hour on a cold wet train platform totally sucked. So then I took a cab instead. That first day in class was tough. The instructor’s voice was fading(she was sick too, but was still going, amazing) and my ears still hadn’t popped so I couldn’t hear anything. Thankfully two Theraflus that night at the hotel fixed me up and by morning I could hear. The second day of class was much more successful, but the instructor’s voice was down to a whisper (but she kept going!!). By the weekend, the illness had come back in full force. Monday I returned to the doctor, and yesterday got an X-Ray to try to figure out what is wrong. But I think I am on the mend. Still a bit of a cough, but nowhere near as bad as I was a month ago, or even 3 days ago.