Freigeben über


Windows Live Writer Plugins & Dirty Diapers!

I've been playing around with Windows Live Writer for a little while now (since it first came out in beta!) and the more I use it, the better it seems to get (in case you haven't used it, I encourage you to check it out).

The only "problem" I've had so far is my lack of understanding on how to create plugins for it. Well my friends - I've worked it out and I intend to share it with you now!

Oh! Before I go any further, let me explain the title of this post...

I've been wanting to write this post for a little while now, but this is the first chance I've had to sit down and have some "time to myself". My wife and I welcomed our new baby daughter into the world a few weeks ago and since then my world has been turned upside down! When I'm not changing diapers, or bonding my her and my wife, I like to try and catch up on the little sleep I seem to be getting at the moment! But just for you (OK.. and me!) I have managed to escape to my office for a while and finally get this article "out the door"... ;)

Anyway, let's get going!

The first step to writing a plugin was working out what I wanted it to do. I finally settled on creating a plugin to insert a thumbnail image of any given web page and have it appear as an image in your blog post.

I was going to write this post about how you create a plugin yourself, but I thought the best way to show you would be to provide the source code for my plugin!

A few points worth mentioning...

  1. When creating a plugin, make sure you add a reference to the WindowsLive.Writer.Api.dll file located in the Program Files\Windows Live Writer directory.
  2. Make sure you add attributes to your class describing the plugin. This is how Windows Live Writer "learns" about your plugin. Mine looks like this:

[InsertableContentSource("Website Image"),

                  WriterPlugin("32a77b7a-5ea4-47be-84fc-ff7471384e10",

                  "InsertWebsiteImagePlugin",

                  ImagePath = "Web.png",

                  PublisherUrl = "https://blogs.msdn.com/jasonward/",

                  Description = "Inserts a thumbnail image of a website into the Live Writer Window"),

                  LiveClipboardContentSource("html", "text/html"),

                  UrlContentSource("https://(.*)",

                  ProgressCaption = "Capturing Website Image..",

                  RequiresProgress = true)]

    public class InsertWebsiteImage : SmartContentSource

So what's the plugin called and where can I get it?

It's called "Insert Website Image" and you can download it from here!

All source code can also be downloaded from here!

Hope this helps,
Jason

p.s - I've hosted all the source code on codeplex, so if you'd like to contribute to this plugin or perhaps even add your own plugin to this project, please let me know!

Comments

  • Anonymous
    February 19, 2007
    Thanks to Jason from DDITWeb, here's a really useful WLW Plugin - It creates a thumbnail of a website.

  • Anonymous
    February 19, 2007
    Spotted by Frank , a very cool new plug-in for Windows Live Writer. This one inserts a thumbnail of a

  • Anonymous
    June 01, 2007
    If you've read my earlier post, Windows Live Writer Plugins & Dirty Diapers! , you'll know that I'm

  • Anonymous
    July 07, 2007
    The comment has been removed

  • Anonymous
    August 26, 2007
    Check out Thumbnailspro.com, they are FREE while in beta any allow to request thumbnails directly from your website, any size you want up to 1000pixels! WOW! thats <a href="http://thumbnailspro.com" alt="website thumbnails" title="website thumbnails">Thumbnailspro.com</a>

  • Anonymous
    January 03, 2010
    Hi,   Do you have any idea in this method public override string GeneratePublishHtml(ISmartContent content, IPublishingContext publishingContext) {    return content.Properties["OutputHTML"].ToString(); } when it return in windows live writer it add <DIV Id='' class=''> so we can remove it ? I need the same html content which i did pass from this method.