Hi Hajo,
The functions in files such as LT_PE.c, LT_wks.c were added with the intention of "extending" LabTalk by adding new script commands using OC functions. Access to PE was not available with LabTalk before and thus the functions in LT_PE were written for that purpose. These functions were therefore written with the view of using them from script window, and so in most cases they just dump/print results to script window.
You can modify the pe_dir() function and create a new one to instead place the result in a string array, such as below:
Easwar
OriginLab
void test()
{
StringArray saDir;
int iRet = my_pe_dir(saDir);
}
int my_pe_dir(StringArray& saDir, string pagename = "", string strPageType = "")
{
string strName;
Folder fld = Project.ActiveFolder();
if( strPageType.IsEmpty() && pagename.IsEmpty() )// no win_type/page_name specified, will show subfolders
{
foreach(Folder sub in fld.Subfolders)
{
strName = sub.GetName();
saDir.Add( "<Folder> " + strName );
}
}
int nWinType = PageTypeStr2Int(strPageType);
PageBase page;
foreach(page in fld.Pages)
{
if( 0 == nWinType || nWinType == page.GetType() )
{
strName = page.GetName();
if(!pagename.IsEmpty())
{
if(strName.Match(pagename) )
saDir.Add( strName );
}
else
saDir.Add( strName );
}
}
return 0;
}