Archive for October, 2006

Feed Reader Comes With A Sidebar

This feature has actually been in my own internal builds for a while now and for whatever reason I never got round to releasing it to you guys . So what’s the sidebar all about then? Well, with some plugins, the creator can put in a sidebar for the content that is inserted into the blog entry from their plugin, this sidebar can then be used to dynamically change said content. So that’s what I’ve included in version 1.5 of my Feed Reader plugin .

Download: here.

SL

 
Whilst writing this, I was listening to JamesSay Something.

9 Comments

Insert Video and Live Spaces… [updated]

Update: Version 2.0.1.4 has been released. Please see below for further details and download links.

My video plugin has always worked well with blogging services that allow you to embed videos into your blog feed, but sadly, it’s never worked for services that don’t allow you to, like Windows Live Spaces. That is, until now….  Ok, so you still can’t physically embed videos into Live Spaces still, but you can do the next best thing with my plugin. What it will do is this: you give it the link, it then goes and looks at the video, takes a screenshot of the video and puts that into your blog and links to the video. Your site’s viewer will still need to go to the video site as though it had been just a normal text link, but at least you are showing them a preview.

Now, I hear the people whos blogging service did allow for video embedding asking "what about us, we can have video embedding, I don’t want an image and a link." Well, you won’t if your site supports video embedding, the plugin will automatically realise this and put the relevant code in instead of the image and link. Thus giving a good all round user experience.

Example:

Version 2.0 of this plugin is still being tested by me and a few private testers, I will be releasing it within the next day or so, so make sure you keep your eyes peeled on this blog

Update:

  • Version 2.0 has been tested and I am happy with its performance as are my testers. Just a couple of things to note, please remember when using this plugin for a service like Live Spaces that it does not embed the video, but puts a screenshot, this is the best that you can get with services that do not allow video embedding.
  • Also, for those of you who are linking to my original version (1.7.0.9) here, please note that this link will remain at that version. Version 2.0 will see a new filename and a new download link, so if you wish for your links to point to the new version, you will need to update them.
  • Any issues you find with the plugin, please leave a comment here or email me at wlm[at]scottisafool.co.uk and please include any errors (screenshots or the error itself), the link of the video, the method you used to embed the video, and your blogging service.
  • If moving from a previous version of this plugin, you will need to remove the insertSoapbox.dll file from the plugins folder.

Download: here.

SL

 
Whilst writing this, I was listening to Bon JoviLay Your Hands On Me.

42 Comments

Feed Reader Gets More Options

Some of the feedback I have got for my Feed Reader plugin has been that the feed items themselves needed more options when inserting them into the blog entry. One of these options, it was suggested, should be the ability to just put a snippet of the feed item into the blog; so that’s what I’ve done, plus one or two extra options

Screenshots:

 

Download link: here.

Also, checking the stats, my plugins have now been downloaded over 3200 times . I thank all those who have downloaded them and use them.

SL

 
Whilst writing this, I was listening to Puddle Of MuddSpin You Around.

13 Comments

Praise For Writer Guide

I was on http://dev.live.com today and found a post mentioning LiveSide’s new developer blog. In there they comment and praise about the guide I am writing for developing Live Writer Plugins .

Check it out:

SL

5 Comments

Welcome

This is my new blog where I will be showcasing some of the development stuff that I do. Mostly it will be to do with Live Writer plugins, but I will possibly try and do more than just that. So: Welcome .

SL

10 Comments

Writing Plugins For Windows Live Writer – Working With Forms

Most plugins for Live Writer will have a form appear when you click on the Insert link within Live Writer, this form will perform the functionality of the plugin and return the code or text that will be put in the blog entry. Within this form, you can do whatever you want the plugin to do, but for this example I will be keeping it simple and showing the basics, letting you code the rest of the plugin and change whatever settings for your form that you want.

Open up your project (I will be continuing with the "MyNewPlugin" example from the previous posts), and create a new form in your project (for this example I will be calling the form frmMyForm). For this example, my form will have only a text box, an insert button and a cancel button, and all it will do is allow the user to enter some text and have it appear in the blog entry when you press insert. In your form, add a textbox and two buttons (I have also added a label to describe what the textbox does), you should have something like this:

Any other properties of this form can be changed as you wish. Except for the textbox which I have called txbxText, I have kept all the original names that get given when the form items are created.

Now we need to tell the buttons what they are going to be done. We’ll start with the cancel button; in the properties of the form, there is a property called CancelButton, just set that to be the cancel button (in this case Button2). For the Insert button, double click it and Visual Studio will create the method for you, we can then add our code into that method. Before we do this though, at the top of the Class (before the initializing method), we need to declare a string variable, so just put in string text;.

In this plugin, all we need to do for the Insert button is assign the DialogResult value, set the text and close the form. So the code we need to put in is:

            DialogResult = DialogResult.OK;
text = txbxText.Text;
this.Close();

Note how we are assigning the text string to equal the text from the textbox. The last thing we need to do for this plugin is just create a string method that returns the text string, this will be called later from the main plugin class.

        public string getText
{
get { return text; }
}

Now, in the main class where we overrode the CreateContent method, we need to add in a new section, so before we had just newContent = "Some text"; we now need to tell the plugin that we want to use our new form:

using (frmMyForm form = new frmMyForm())
{

Now, you might remember in the last post that I mentioned about the DialogResult section (and I also touch upon it above), this is where it actually comes in to play. Once we have told the plugin to use the form, we need to create a new DialogResult that opens up our newly called form, so we insert the next line:

                DialogResult result = form.ShowDialog();

In the form when we click on the Insert button, we set the DialogResult to equal DialogResult.OK, this signifies that an OK was pressed in a dialog, so we can check for this by using an if statement. Within that if statement, we are going to set the newContent value to equal the getText string from the form:

                if (result == DialogResult.OK)
{
newContent = "You entered: " + form.getText + ".";
}

We now need to close off all open sections (using a } ) . Hopefully you can see where everything falls into place, form.getText is the public string that we set to return the text string in the form, and the text string gets the value of the textbox, which is what finally gets inserted into the blog entry.

Any questions about this post please feel free to leave a comment, as this one is a little more involved that the previous two steps.

Download Source Code: here.

SL

<< Previous – Adding an Icon

13 Comments

Writing Plugins For Windows Live Writer – Adding An Icon

Ok, so now that we have the basis for our Live Writer plugin, we need to start adding things to it to make it look and feel better. The best way is to add an image to the plugin that will appear in the Insert section of Writer.
This is actually very easy, but there are things that you need to remember other wise you will get runtime errors when Live Writer starts up. So first of all, we need to create our little icon, which is what the end user will see in the options and on the right in the Insert field. The thing you have to remember when making this, is its size: it has to be exactly 20×18 pixels. For this demo, I’m going to be using this image: .
The image that I am using I have called icon.gif, and to put it into our project, we can just drag and drop into Visual Studio Express:
This next part is very important otherwise you will be getting an error saying that the image can’t be found and you will be wondering why as you can see it in your project. Right click on the image in the solution explorer, select properties; in the properties, you have a section called Build Action, and you want to set it to Embedded Resource:
So going back to the code from the previous article, we need to add in an extra attribute to the plugin, with the resulting code looking like this:
[WriterPlugin("8638eda4-6533-4d19-9da7-ff92ff5a7590","My First Plugin",
Description="This is my first plugin",
HasEditableOptions=false,
Name="My First Plugin",
PublisherUrl="http://scottisafool.spaces.live.com",
ImagePath="icon.gif")] // This line is where we put the image in the code
The part that we are looking at here is the ImagePath="icon.gif" part. This filename has to correspond to what you have put into the project; now, if that file is in a folder, for example "images", then the ImagePath would be "images.icon.gif". Notice we use a full stop instead of a slash. Once you have put that in, you’re ready to rock and roll; so hit F6 in Visual Studio and let it compile.
Now when we load Live Writer up, we have our link as before, but now it has the image we have assigned to it:
As before, the source code is available here.
SL

12 Comments

Writing Plugins For Windows Live Writer – Getting Started

In this article, I am going to show how to create a simple plugin for Windows Live Writer, starting from the beginning. Writing plugins for Live Writer is simple enough, but sometimes you just need a little helping hand, and I’m speaking from experience .
First off, you will need to make sure that you have the required programs. Make sure that you have the following installed:
  • Windows Live Writer – download
  • Microsoft .NET Framework v2.0 – download
  • Visual Studio Express C# Edition – download (this link takes you to an installer that will require you to download the rest of the files).
Once you have installed them then we are ready to go. Open Visual Studio and start a new project, selecting Class Library andgive the plugin a name. For this example, I will call it MyNewPlugin.
Now we need to tell the plugin to look at the Windows Live Writer API. In the Solution Explorer on the right hand side, right click on the References folder and select ‘Add Reference’ and browse to the Live Writer folder in your Program Files folder. The dll we want is WindowsLive.Writer.API.dll:
Now that the reference has been create we need to tell the plugin to actually use the APIs, so we need to add
using WindowsLive.Writer.Api;
You should also add the reference for Windows Forms. So, following the same procedure we have just done, add the System.Windows.Forms reference from the .NET section, and again tell the plugin that we need to use it
using System.Windows.Forms;
Next we need to set the plugin’s attributes:
    [WriterPlugin("8638eda4-6533-4d19-9da7-ff92ff5a7590","My First Plugin",
Description="This is my first plugin",
HasEditableOptions=false,
Name="My First Plugin",
PublisherUrl="http://scottisafool.spaces.live.com")]
Now, the first thing you see in those attributes is the GUID (the combination of numbers and letters), this is unique to each plugin that you make. To get the GUID for your project, right click on the project name in the Solution Explorer and click on properties, then click on the Assembly Information button in the next screen:
The second string is the text that will appear in Live Writer’s Plugins section in the Options; the Description is what appears underneath the list of plugins when you have clicked on your plugin in the options of Live Writer; HasEditableOptions is either true or false and this tells Live Writer whether to put an options button in the Plugin options (for most plugins you probably won’t need this set to true, and you certainly don’t for this example); PublisherUrl is where you put the link to your site.
Underneath the WriterPlugin code, we need to set what text appears in the Insert section. So we use the code:
[InsertableContentSource("From MyNewPlugin")]
Time to declare the plugin’s main class
public class NewPlugin : ContentSource
{
public NewPlugin()
{
}
Note: after declaring the public class, you must call that class, but keep it empty as in the example above.
Next we need to override the main class (this is why it was left blank), and we put in the following code:
public override DialogResult CreateContent(IWin32Window dialogOwner, ref string newContent)
{
The ref string newContent is what actually gets put back into the blog entry, so we need to set that to equal something:
newContent = "This was put in by my first Live Writer Plugin :)";
Because of how the override works, we need to return a DialogResult of OK (I will go into this in more detail in another post), so we simply put in:
return DialogResult.OK;
Close off anything that is open (ie, }). That is your plugin written, now we need to build it. Before we do though, we should add a command into the post-build section. So, right click on your plugin name in the Solution Explorer and click on properties. Select the Build Events section and copy the following command into the post-build event section:
XCOPY /D /Y /R "$(TargetPath)" "C:\Program Files\Windows Live Writer\Plugins\"
Now we are ready to build the plugin. Hit F6 on your keyboard and watch the fun begin . Once the build has finished successfully, open up Windows Live Writer and in the Insert section, you will see your link:
Click it and you will see the text we set for newContent is now in your blog entry. So we have now created a basic plugin for Windows Live Writer
Download the sourcecode for this example here.
Next time I will talk you through how to add an image to your link.
SL

14 Comments