The following Approach should work ...
typedef bool (*project_user_modify) (vector<double> &dargs, vector<string> &strArgs);
bool ModifyProjects(vector<double> dArgs, vector<string> strArgs, project_user_modify UserFunc)
{
StringArray strOPJpaths,strFiletypes;
strFiletypes.SetSize(2);
strFiletypes[0]="[Origin Projects]*.opj";
strFiletypes[1]="[Origin Projects]*.org";
string strDlgName="Select ONE or MORE Origin Project Files";
int NumFiles = GetMultiOpenBox(strOPJpaths,strFiletypes,NULL,NULL,strDlgName,false);
if(NumFiles>0)
{
SetDataDisplayText("Project Batch Processing Begins ...");
string strPathToProject;
int j=0;
vector<double> dArgs;
vector<string> strArgs;
for(int i=0; i<NumFiles;i++)
{
strPathToProject=strOPJpaths[i];
if(strPathToProject.IsFile()==false)
{
SetDataDisplayText("Invalid FilePath Error ...");
return (false);
}
if(Project.Open(strPathToProject)==false)
{
SetDataDisplayText("Project Opening Error ...");
return (false);
}
if(UserFunc(dArgs,strArgs)==false)
{
SetDataDisplayText("Project Modification Error ...");
return (false);
}
if(Project.Save(strPathToProject)==true)
{
j++;
continue;
}
SetDataDisplayText("Project Save Error ...");
return (false);
}
string strTemp;
strTemp.Format("%d",j);
SetDataDisplayText("..."+ strTemp+" Projects Modified ...");
return (true);
}
SetDataDisplayText("No Project Files Selected ...");
return (false);
}
bool MyProjFunction(vector<double> &dargs, vector<string> &strArgs)
{
/*
Code for Operating on Origin Project Goes Here ...
dArgs and strArgs can be used to transfer numerical amd string arguments to/from the Origin Projects
On Success return ... true
On Failure return ... false
*/
return (true);
}
void ExecFunc()
{
vector<double> dArgs;
vector<string> strArgs;
if(ModifyProjects(dArgs, strArgs,MyProjFunction)==true)
{
return;
}
}
If you incorporate your OC code to modify the projects in the space indicated, You can then compile the lot and the type the command "ExecFunc()" in the command window.
As written you should be able to navigate to the desired directories, select the projects that need modification and then execute your modification code on the selected projects.