If my reading of what you are trying to do is correct you do not need to get a list of folder paths ... and it is probably be easier achieve your desired goal(s) using OriginC in place of labTalk.
The following OC code is an example. It will enable you to browse the various directories to find the files that you want to import and to import the data into an Origin worksheet using the "Open -w ..." LT command
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);
}