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
 How can I get the OXF path?

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
ZanHUNG Posted - 05/25/2016 : 03:40:43 AM
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2016 SR2
Operating System: Windows 7

I put some file and OXF in the same folder. I want to read/write it in X-Function. However, when editing the X-Function,
__FILE__
is actually the path of the corresponding XFC path, NOT OXF path. Hard-coding is not an option for me.

Question: How can I get the OXF path?

Thanks!

2   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 06/04/2016 : 4:21:23 PM
I tried this and just want to document the info here. I created a simple XF in UFF called mytest, and here is the code


void mytest(const double& x)
{
	//begin code to print the XF path
	string strXF = "mytest";// had to hard code the name here
	string strPath;
	if(okutil_find_file_from_composite_name(&strPath, strXF, SUPPORTFILE_XF, ORIGIN_PATH_UNDEF) == ORIGIN_PATH_UNDEF)
		out_str("not found");
	else
	{
		string strOxfPath = GetFilePath(strPath);
		out_str(strOxfPath);
	}
	//end code
}


int mytest_event1(TreeNode& trGetN, int nRow, int nEventID, DWORD& dwEnables, LPCSTR lpcszNodeName, WndContainer& DynaCntrlContainer, string& strAux, string& strErrMsg)
{
	if( xf_is_extended_event(nEventID) )
		return mytest_event1_ex(trGetN, nRow, nEventID, dwEnables, lpcszNodeName, DynaCntrlContainer, strAux, strErrMsg);
	DECLARE_BUTTON_ENABLES
	//begin code to print XF path, you can see this by "mytest -d"
	//in event1, don't need to asssume XF name since it can be obtained from tree
	string strXF, strPath;
	trGetN.GetAttribute(STR_CLASS_OPTION_NAME_ATTRIB, strXF);
	okutil_find_file_from_composite_name(&strPath, strXF, SUPPORTFILE_XF, ORIGIN_PATH_UNDEF);
	out_str("in XF event, path is");
	out_str(GetFilePath(strPath));
	//end code print XF path
	return false;

}

Chris D Posted - 05/26/2016 : 2:50:08 PM
Hi Zan,

Try this function. Pass it the X-Function name. Just the name- no file extension- and it is case-sensitive!! If it returns true, then the strOxfPath parameter will contain the full path to the folder containing the relevant OXF file.

Note: I have not thoroughly tested it so you should.


int MyXfOxfPath(string StrXfName, string& strOxfPath)
{
	StringArray saNames, saFiles;
	
	okutil_find_xf_files(StrXfName, &saNames, &saFiles); // Defined in oUtils.h, line 728.
	if (1 != saNames.GetSize() || 0 != strcmp(saNames[0], StrXfName))
		return false;
	
	string strFile = saFiles[0];
	if (!strFile.IsFile())
		return false;
	
	strOxfPath = GetFilePath(strFile);
	return true;
}


Thanks,
Chris Drozdowski
Originlab Technical Support

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