This is a pretty roundabout way, indeed, and one of the consequences is that it's really hard to customize the dialog. (The code creates a shell, directs the shell to run an HTML application providing the code in the command line, the HTML application is set up to display a file input control and automatically activate it on launch, then the application tries to pass the resulting value via standard output and the code tries to read it back from the shell. You can see that the file dialog is almost a side effect, it's three layers deep.)
The documentation for the file input offers no way to let the dialog handle new files: file input control.
I suggest just using VB.NET:
' $reference: System.Windows.Forms.dll
Shared Manifold As Manifold.Context
Shared Sub Main()
Dim dlg As New SaveFileDialog
dlg.Filter = "CSV Files (*.csv)|*.csv"
dlg.FilterIndex = 1
If dlg.ShowDialog() = DialogResult.OK Then
In the future, we might add commands invoking standard dialogs to the API - or, better yet, make it easier for a script in one language to call a script in a different language and pass results (this can be done now as well, and there are ways to pass results, but these ways are indirect).