How to export a quick image with viewport frame from opened document using C#

Hey guys,

I have a C# program that needs to be able to automatically to an “Export a quick image” with “viewport frame” from the currently opened document.

Do you have some API commands that allow me to do that?

IF not, do you have some suggestions?
Should I use some of those libraries that allow me to automatically press the buttons within the tools?

_WinWaitActivate(“Grasshopper - Test”,"")
MouseClick(“left”,25,43,1)
_WinWaitActivate(“Quick Image Editor”,"")
MouseClick(“left”,93,48,1)
_WinWaitActivate(“Grasshopper Canvas Image”,"")
Send(“canvasSnapshot”)

find attached C#

ScreenCaptureToFile.gh (5.1 KB)