A VSTO add-in that turns Microsoft PowerPoint into a remote-controlled service via Windows Named Pipes.
Any application can connect to the pipe and control PowerPoint — slide navigation, slide show management, media region detection, and more.
┌─────────────────────┐ Named Pipe ┌──────────────────┐
│ Any Application │ ◄──── JSON ────► │ PowerPoint │
│ (Console, WPF, │ "PPTAgent_Pipe" │ + PPTAgent VSTO │
│ Python, C++, ...) │ │ Add-in │
└─────────────────────┘ └──────────────────┘
| Project | Target | Description |
|---|---|---|
PPTAgent.Contracts | netstandard2.0 | Protocol definitions — message types, pipe frame format, state models. This is the SDK. |
PPTAgent.AddIn | net472 (VSTO) | The VSTO add-in that runs inside PowerPoint. Requires Visual Studio with Office development tools. |
samples/ConsoleClient | net8.0 | Sample interactive client demonstrating the protocol. |
dotnet build PPTAgent.slnDeploy PPTAgent.AddIn.vsto (found in the build output) via:
- Double-click the
.vstofile, or - Use
InstallUtil.exe, or - Register via Visual Studio
Option A: Reference PPTAgent.Contracts NuGet / DLL
usingSystem.IO.Pipes;usingPPTAgent.Contracts;usingNewtonsoft.Json;varpipe=newNamedPipeClientStream(".",PipeConstants.PipeName,PipeDirection.InOut);pipe.Connect();// Send a commandvarmsg=newPPTPipeMessage<object>{Version=1,Type="cmd",Cmd="next",RequestId=Guid.NewGuid().ToString("N")};PipeFrame.WriteFrame(pipe,JsonConvert.SerializeObject(msg));// Read responsestringjson=PipeFrame.ReadFrame(pipe);varresponse=JsonConvert.DeserializeObject<PPTPipeMessage<object>>(json);Option B: No dependencies (any language)
The wire protocol is trivial:
[4-byte LE int: payload length][UTF-8 JSON payload]
JSON message format:
{
"Version": 1,
"Type": "cmd",
"Cmd": "next",
"Data": null,
"RequestId": "unique-id"
}| Cmd | Data | Description |
|---|---|---|
state | — | Get current PowerPoint state |
next | — | Next slide |
prev | — | Previous slide |
gotoSlide | {"SlideNumber": N} | Jump to slide N |
startSlideShow | — | Start slide show |
endSlideShow | — | End slide show |
showSlideNavigation | — | Show slide navigation panel |
disableAutoPlayTimings | — | Disable auto-advance |
unhideHiddenSlides | — | Unhide all hidden slides |
getMediaRegions | — | Get media control regions on current slide |
exportSlideThumbnails | {"Width":W,"Height":H} | Export slide thumbnails (not yet implemented) |
{
"Version": 1,
"Type": "response",
"Cmd": "state",
"Success": true,
"Data": { "SlideIndex": 1, "TotalSlides": 10, "IsRunning": true, ... },
"RequestId": "matching-request-id"
}{
"Version": 1,
"Type": "event",
"Cmd": "slideShowBegin",
"Data": { "SlideIndex": 1, "TotalSlides": 10, "IsRunning": true, ... }
}Events: presentationOpen, presentationClose, slideShowBegin, slideShowNextSlide, slideShowEnd
{
"Version": 1,
"Type": "error",
"Success": false,
"Error": "Unknown command: foo",
"RequestId": "matching-request-id"
}Change the pipe name before starting the host (e.g., for multi-instance scenarios):
PipeConstants.PipeName="MyCustomPipeName";- PowerPoint must be running with the PPTAgent add-in loaded
- .NET 6.0 SDK or later
cd samples/ConsoleClient
dotnet runThe console client will:
- Connect to the PPTAgent named pipe
- Display an interactive menu:
PPTAgent Console Client ======================= Connecting to pipe: PPTAgent_Pipe Connecting... Connected! Commands: 1) Get state 2) Next slide 3) Previous slide 4) Goto slide 5) Start slide show 6) End slide show 7) Show slide navigation 8) Disable auto-play timings 9) Unhide hidden slides 0) Exit > - Send commands and display responses
- Receive and display events (e.g.,
slideShowBegin,slideShowNextSlide) in real-time
GPL-3.0