The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 pe_dir("*","w");
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hajo_old

Germany
141 Posts

Posted - 08/09/2004 :  04:06:26 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello, all

I want to use the above function pe_dir("*","w") (LabTalk) in a OriginC program.

The help says that there's no return value available. What I would like to have is the following:

 array<string> arrWks;
arrWks = pe_dir("*","w");


So, how can I "redirect" the output of pe_dir("*","w") to an array of strings?

Thanks for help
Hajo

-- --
Dipl.-Ing. Hans-Joerg Koch
SiemensVDO Automotive
Regensburg

rlewis

Canada
253 Posts

Posted - 08/09/2004 :  09:46:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Open Codebuilder and take a look in the system workspace.
The source code for the pe_dir function is listed in LT_PE.c
Go to Top of Page

easwar

USA
1964 Posts

Posted - 08/09/2004 :  10:27:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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;
}


Go to Top of Page

hajo_old

Germany
141 Posts

Posted - 08/10/2004 :  02:59:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello, Easwar

thanks a lot for the code!
Could you add that as an overloded function to the OC source? I think not only I'm interested in that ...

Thanks
Hajo

-- --
Dipl.-Ing. Hans-Joerg Koch
SiemensVDO Automotive
Regensburg
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000