Menu

Creating Plug-ins

Alexander Leithner
Valid for versions: 1.4 and above
This wiki page is valid for versions 1.4 and above.

Creating Plug-ins

With the version 1.4 we introduce our new Plug-in system. For creating a plug-in you have to code, so this isn't something for beginners.

HOW DOES A WINPEN++ PLUG-IN WORK?
WinPen++ Plug-ins are basically four files:

  • Plug-in.exe The main executeable of your Plug-in.
  • Plug-in.xml The configuration for your Plug-in.
  • Plug-in.txt The file to communicate with WinPen++.
  • Plug-in.png A 16×16 pixel PNG-File, the icon for the button of your Plug-in.

When loading WinPen++ it searches the Plug-in folder for XML-Files and creates a tool Button with your icon.
Then it adds a click-event and your Plug-in.exe, which should have the name of your plug-in, will be started.

IS THERE A STEP-BY-STEP GUIDE FOR CREATING PLUG-INS?
Yes, of course! Just read on!

Step-by-Step: Creating Plug-ins for WinPen++

1. Write your own Assistant
First, we need a new Programm, your assistant. Just write it like other normal programs.

2. Make it communicate with WinPen++
Now, we must add some lines of code at the closing method of your program:

string text = <RETURN VALUE>;
string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WinPen++", "Plugins", "Returns", "<THE NAME OF YOUR ASSISTANT>.txt");
File.WriteAllText(path, text);
Replace these with that
RETURN VALUE The string, which should be inserted into the opened file in WinPen++.
THE NAME OF YOUR ASSISTANT Simply replace it, with what it says. This file will be read in by WinPen++ to insert the RETURN VALUE into the file.

3. Build your Project
Now, let Visual Studio or what ever build your assistant. You should get a Exe-file. Put this EXE-file into

C:\Users\<your user name\AppData\Roaming\WinPen++\Plugins\Executeables

Now, you must add a XML-file into ...AppData\Roaming\WinPen++\Plugins.
It would be as follows:

plugin.xml:

<?xml version="1.0"?>
<doc>
 <Plugin>
  <name>NAME</name>
  <author>Your Name</author>
  <type>assistant</type>
  <place>tools</place>
  <icon>Icons/file.png</icon>
  <exename>Executeables/plugin.exe</exename>
  <returnvalueholder>Returns/plugin.txt</rvh>
 </Plugin>
</doc>

You can use the following values for the plugin.xml:

Tag Possible values and description
type assistant Your plug-in would be an assistant.
handler (From 1.6 on) This would be a plug-in which doesn't return something (for example, you can make a C# compiler).
place tools The button for your plug-in will be located in the toolstrip.
menu Your button will be located in the File (for handlers) or in the Assistants (for assistants) menu.
icon Should be a 16×16 pixel PNG-image.
exename The name of the EXE for your plug-in.
returnvalueholder Should be a TXT file.

4. Place the icon for your plug-in.
Now, you have done 85% of the modding process. Now, you will have to place your icon in C:\Users\<your user name\AppData\Roaming\WinPen++\Plugins\Icons and maybe rename it so that it matches the name given in plugin.xml.

5. Creating the communication.
Now, go to C:\Users\<your user name\AppData\Roaming\WinPen++\Plugins\Returns in Windows Explorer, right click and select New > Textfile and name it that it matches the name given in the XML.

! NOTE ! |
--- | ---
Please remember, that all files, named with
plugin.* should be renamed to your project's
name. | From plugin.xml would be e.g. MySuperPlugin.xml.
Please don't forget to rename all of these files!


MongoDB Logo MongoDB