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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 pe_dir("*","w");

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
hajo_old Posted - 08/09/2004 : 04:06:26 AM
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
3   L A T E S T    R E P L I E S    (Newest First)
hajo_old Posted - 08/10/2004 : 02:59:14 AM
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
easwar Posted - 08/09/2004 : 10:27:50 AM
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;
}


rlewis Posted - 08/09/2004 : 09:46:58 AM
Open Codebuilder and take a look in the system workspace.
The source code for the pe_dir function is listed in LT_PE.c

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000