Click here to Skip to main content
15,390,470 members
Articles / Programming Languages / C#
Posted 10 Feb 2007


12 bookmarked

Goto Shrinkster

Rate me:
Please Sign up or sign in to vote.
3.00/5 (1 vote)
10 Feb 2007CPOL2 min read
Quickly go to a url.



Do you listen to podcasts that have links in them? Shrinkster provides a service where it takes a url, compresses it, and allows you to use this compressed url in place of a long url.

As I'm listening to a podcast and a Shrinkster code is mentioned, I would switch to a browser and type, hit enter and then be transported to that page. After typing the Shrinkster url a few times I thought a short cut was in order, which led to this this small Windows utility that opens a new IE browser when you enter a Shrinkster code. The utility does only one thing: opens a new browser, with the Shrinkster url and code preloaded. Shrinkster will then redirect you to the uncompressed url.

I'll explain the usage of the application and then review the code.

Please note: The .Net Framework 2.0 is needed for this application!

Using 'Goto Shrinkster'

Starting the executable, GotoShrinkster.exe, brings up the application. It defaults to a starting position in the lower right corner of your screen. It also remains on top of the other windows so it is quickly found when a Shrinkster code is mentioned during a podcast.

GoToShrinkster after initial startup To use, enter a code in the text box, press the Go button or hit enter, and a new browser will start! If you entered a valid code, Shrinkster will quickly redirect you to the uncompressed link. Example: Entering 'dpn'

Demo using a code

into the utility and hitting enter takes you to a page on Scott Hanselman's blog. Scott's weekly talk shows use Shrinkster codes frequently.

The Code

From the screen shots you can see that the application is small and relatively straight forward. On the Windows Form, a ToolStrip contains just three items, a ToolStripLabel, a ToolStripTextBox, and a ToolStripButton. The ToolStripTextBox is configured to take a maximum of 50 characters. Since the Shrinkster codes are fairly small, this should be sufficient. The ToolStripButton (the Go button) will cause the application to launch a new browser if you have entered something into the ToolStripTextBox. The code that is executed is the LetsGo method, which uses a WebBrowser control to launch IE.
/// <summary>
/// See if we have a code to use, and if so, build the URL and head off. 
/// </summary>
private void LetsGo()
    if (browserCode.Text.Trim().Length > 0)
        WebBrowser wb = new WebBrowser();
        wb.Navigate(BuildUrl(), true);
        wb = null;
        browserCode.Text = "";
} //ends LetsGo

/// <summary>
/// Build the full url with the code entered from the app. 
/// Note: Normally I don't like to hard code things like this url but 
/// due to the nature of the utility I didn't want to have a config 
/// file, registry entry, etc on the client. 
/// </summary>
/// <returns>URL</returns>
private string BuildUrl()
    return "" + browserCode.Text.Trim();
} //ends BuildUrl
Pressing enter while in the ToolStripTextBox will also trigger the launch sequence. To do this, the application monitors your key presses by overriding the inherited ProcessCmdKey method, looking for 'enter.' The overridden method looks like:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
    //if you hit enter while in the text box then lets go
    if (keyData == Keys.Enter && this.ActiveControl != null)
    return base.ProcessCmdKey(ref msg, keyData);
}  //ends ProcessCmdKey


I created this utility to have a small footprint on the screen since I'm usually doing multiple other things while listening to a podcast. By having it on top all the time I can quickly enter in a Shrinkster code. I think you'll find this utility usefull and a time saver.

Revision History

2007-02-09 Original submission.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
United States United States
Rich has worked in IT for over 24 years, in various industries and locations. He has been working with SharePoint technologies for the past 2 years doing application development, administration, installation, and configuration. He currently resides in the Midwest with his family.

Comments and Discussions

GeneralA quick an Easy alternative Pin
James Curran12-Feb-07 9:56
MemberJames Curran12-Feb-07 9:56 
GeneralAnother quick alternative -- FireFox add-in Pin
codelacky9916-Feb-07 19:37
Membercodelacky9916-Feb-07 19:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.