2.2.7.7 OriginApp


Name

OriginApp

Remark

Launch a new Origin instance. A new instance will be launched even if another instance of Origin already exists.

Hierarchy

  • OriginApp

Examples

#include <..\Originlab\OriginApp.h>
void OriginApp_ex()
{
	OriginApp oa;
	
	if (0 != oa.Open(GetAppPath(TRUE) + "Samples\\Data Manipulation\\Setting Column Values.opj") )
		return;
	Object finder = oa.GetFinder();
	if ( finder )
	{
		finder.Locations = (FINDOBJECT_COLUMN|FINDOBJECTCNTRL_PROJECT); // FINDOBJECT_MASK for all
		finder.Options = (FINDMETADATACNTRL_MATCH_WHOLE_WORD|FINDMETADATACNTRL_LONG_NAME|FINDMETADATACNTRL_SHORT_NAME|FINDMETADATACNTRL_COMMENTS|FINDMETADATACNTRL_ONE_INFO_VARIABLE);

		Tree trResults;
		int nCount = finder.Find("Time");
		for ( int ii = 0; ii < nCount; ii++ )
		{
			Object obj;
			obj = (finder.GetObject(ii));

			TreeNode trResult;
			trResult = trResults.AddNode("obj"+(ii+1));
			
			string strRange = obj.Range;
			trResult.AddTextNode(strRange, "Range");
			string strPEPath = obj.PEPath;
			trResult.AddTextNode(strPEPath, "PEPath");
			string strType = obj.TypeName;
			trResult.AddTextNode(strType, "Type");
			string strName = obj.Name;
			trResult.AddTextNode(strName, "Name");
			string strLongName = obj.LongName;
			trResult.AddTextNode(strLongName, "LongName");
			
			if ( strType == "GraphPage" )
			{
				string strImageFile("D:\\Working\\test.png");
				bool bPreview = obj.Preview(strImageFile);
				if ( bPreview )
					trResult.AddTextNode(strImageFile, "Preview");
			}

			_VARIANT v = finder.GetMetadata(ii);
			DWORD dwMetaDataFound = v;// in this case, it's FINDMETADATACNTRL_LONG_NAME
			trResult.AddNumericNode(dwMetaDataFound, "Attributes"); 

			_VARIANT v2 = finder.GetMetadataValue(ii);
			string strXML;
			strXML = v2;
			Tree tree;
			tree.SetString(strXML);
			TreeNode trMetadatas = trResult.AddNode("Metadatas");
			trMetadatas.Replace(tree, true, true);
		}
		
		out_tree(trResults);
	}
}

Header to Include

OriginApp.h

Reference

Members

Name Brief
Object GetFinder()
Returns the finder object.
bool LTExecute( LPCSTR lpcszLabtalkScript )
Execute LabTalk script code.
int Open( LPCSTR fileName, bool bCheckSameOpj = false )
Open the specified Origin project file, replacing the contents of the current Origin session.
int ProjectSearch( LPCSTR lpcszText, Tree & trResult )
Query objects inside Origin.