2.1.39 ProjectSearch


Description

Query objects inside Origin

Syntax

VB: Function ProjectSearch(text As ByVal String) As String
C++: LPCSTR ProjectSearch(LPCSTR text )
C#: string ProjectSearch(string text )

Parameters

text
The string contains the content for searching

Return

The ProjectSearch method returns XML string as search result.

Remark

Examples

Python

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

Version Information

Origin 2018 SR0

See Also

GetFinder