Query objects inside Origin
VB: Function ProjectSearch(text As ByVal String) As String
C++: LPCSTR ProjectSearch(LPCSTR text )
C#: string ProjectSearch(string text )
The ProjectSearch method returns XML string as search result.
EX1
import OriginExt as O app = O.Application(); app.Visible = app.MAINWND_SHOW pageName = app.CreatePage(app.OPT_WORKSHEET) searchResult = app.ProjectSearch("1") print(searchResult)
EX2
import OriginExt as O import os str = input('to search for:') root = 'c:\\tmp\\' flist = [] for fn in os.listdir(root): if fn.endswith('.opju') or fn.endswith('.opj'): fullpath = root + fn flist.append(fullpath) app = O.Application() found=[] for afile in flist: if app.Load(afile): result = app.ProjectSearch(str) app.Execute('doc -s')#to prevent asking to save if len(result) > 10: print('*',end='') found.append(afile) else: print('.',end='') print('done') for fopj in found: print(fopj) app.Exit() del app
Origin 2018 SR0
GetFinder