Try the following ...
(a) Open the CodeBuilder workspace
(b) Create an ?????.C file (File New in the Codebuilder menu)
(c) Copy the origin C functions below to the new origin C file created
(d) Add the file to the CB workspace (Right ckick System AddFiles)
(e) Compile the Origin C file (Tools Build in the CodeBuilder menu)
#include <Origin.h>
////////////////////////////////////////////////////////////////////////////////////
bool Import_Data(void)
{
StringArray strFiletypes, strFilePaths;
strFiletypes.SetSize(1);
strFiletypes[0]="[My Data Files]*.*";
string strDlgName="Selecting My Data Files";
int NumFiles = GetMultiOpenBox(strFilePaths,strFiletypes,NULL,NULL,strDlgName,false);
if(NumFiles>0)
{
for (int i=0;i<NumFiles;i++)
{
string PathToFile=strFilePaths[i];
if (ProcessDataFile(PathToFile)==false)
{
return (false); // Terminate Data import of ProcessDataFile error
}
}
return (true);
}
return (false);
}
static bool ProcessDataFile(string PathToFile)
{
string PathToTemplate=GetAppPath(true)+"origin.otw";
WorksheetPage wPg;
if(wPg.Create(PathToTemplate,true)==true)
{
Worksheet Wks=wPg.Layers(0);
string strLTcommand="Open -w "+PathToFile;
if(LT_execute(strLTcommand)==true)
{
// Code for additional processing of the data imported into the worksheet ...
string FileName=GetFileName(PathToFile);
wPg.Rename(FileName);
return (true);
}
}
return (false);
}
Under origin 7.5 or Higher the code listed above should compile without error
You can then open the script window and enter the command ...
Import_Data() ... to execute the function ...