Scratchpad plugins
This help topic will teach you about installing, using an creating Scratchpad plugins.
Installing plugins
Scratchpad plugins come in the form of .dll files. Plugins will be loaded from the following location:
%localappdata%\Sawblade Software\Scratchpad\PluginsSo to install plugins, simply copy the corresponding .dll files to that location.
Creating plugins
As plugins are simple .NET class libraries, creating them is a simple process. First, make sure you have the .NET 10 SDK installed on your machine. It's also recommended to install either Visual Studio 2026 or Visual Studio Code with the C# Dev Kit extension, but any code editor will suffice. This guide will assume you are using Visual Studio 2026.
First up, create a new project. Open up a PowerShell window, navigate to the location where you want your code to live, and create a new class library project:
mkdir YourPluginProjectName
cd YourPluginProjectName
dotnet new classlib -o YourPluginProjectName -f net10.0
dotnet new sln
dotnet sln add .\YourPluginProjectName\YourPluginProjectName.csprojAlternatively, if your are using Visual Studio 2026, you can create a new project using its project creation wizard.
Now open up the project. To be able to interface with Scratchpad, you will need to add a reference to the Scratchpad plugin API assembly. To do this, right click on References
in the Solution Explorer
and click on Add project reference...
. In the Reference Manager window, click on Browse...
and add select the following file:
C:\Program Files\Sawblade Software\Scratchpad\Sawblade.Scratchpad.PluginAPI.dllNext, we will also need to tell the compiler that we'd like to use Windows Forms. So, open the .csproj file and add the following entry to the end of the first <PropertyGroup>:
<UseWindowsForms>true</UseWindowsForms>Also change the <TargetFramework>net10.0</TargetFramework> line to <TargetFramework>net10.0-windows</TargetFramework>.
Afterwards you might need to reload the project for the changes to take effect.
Next, Rename the Class1.cs file to Plugin.cs. This will be the entry point of our plugin.
For Scratchpad to discover our class, we will need to implement the IPlugin interface. Your class should now look something like this:
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Sawblade.Scratchpad.PluginAPI;
5
6namespace YourPluginProjectName
7{
8 public class Plugin : IPlugin
9 {
10 // Give your plugin a unique ID in reverse domain name notation
11 public string ID => "com.example.yourpluginname";
12
13 // The display name of your plugin
14 public string Name => "Your Plugin Name";
15
16 // Provide the plugin author's name and website
17 public (string Name, string URL) Author => ("Your Name Here", "https://example.com/");
18
19 // Return all actions provided by the plugin
20 public IEnumerable<IAction> ProvidedActions => [
21 // Add your actions here
22 ];
23 }
24}
Next, we'll need an action that the plugin can return. The easiest one to create is a simple generator. Add a new class and name it something like HelloWorldGenerator.cs. Next, you will need to implement the IGenerator interface. Inside the Generate method, we will return something simple like "Hello, world!". The class will look something like this:
1using System;
2using System.Drawing;
3using Sawblade.Scratchpad.PluginAPI;
4
5namespace YourPluginProjectName
6{
7 public class HelloWorldGenerator : IGenerator
8 {
9 // This needs to be unique within your plugin
10 public string LocalID => "helloworld";
11
12 // This name will be displayed inside the actions list
13 public string Name => "Hello, world!";
14
15 // The tooltip for the action
16 public string Description => "Your first generator!";
17
18 // Optionally, you can return an icon
19 public Bitmap? Icon => null;
20
21 // Whatever you return here will appear when running this action
22 public string Generate()
23 {
24 return "Hello, world!";
25 }
26 }
27}
Now we will return this action in our Plugin class:
19 // Return all actions provided by the plugin
20 public IEnumerable<IAction> ProvidedActions => [
21 new HelloWorldGenerator(),
22 ];
That should be it. Go ahead and compile your plugin and install it as described above. Start up Scratchpad and try it out!
You can download the sample code from this article from here: Sawblade-Scratchpad-Plugin-Sample.zip.