I'm tring to create a script thats shows a dialog where I can select a path to save a file. The following got it almost, but this is to open a file, not save it.
var filePath = OpenCSVFileDialog();
var fileName = GetFilenameFromPath(filePath);
function OpenCSVFileDialog()
{
var Project;
var Filename, FilterString, Filterindex, Flags, InitialDirectory, OpenorSave, filepath;
Filename = "";
FilterString = "CSV Files (*.csv)|*.csv|All Files (*.*)|*.*||";
Filterindex = 1;
Flags = 0;
InitialDirectory = "";
OpenorSave = 0;
Project = Repository.GetProjectInterface();
filepath = Project.GetFileNameDialog(Filename, FilterString, Filterindex,
Flags, InitialDirectory, OpenorSave);
return filepath;
}
function GetFilenameFromPath(filePath)
{
var bsindex, fileName;
// find the last backspace in the file path
bsindex = filePath.lastIndexOf("\\");
if (bsindex > 0)
{
// get the name of the file only - minus the directory path
fileName = filePath.substring(bsindex+1, filePath.length);
}
else
{
fileName = filePath;
}
return fileName;
}